From 13253714b46073d178e90de98c4753c8f612943d Mon Sep 17 00:00:00 2001 From: Ning Shang Date: Thu, 10 Dec 2020 15:03:45 +0800 Subject: [PATCH] catch error --- .../training_service/local/localTrainingService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ts/nni_manager/training_service/local/localTrainingService.ts b/ts/nni_manager/training_service/local/localTrainingService.ts index 42b007de35..87149ea05f 100644 --- a/ts/nni_manager/training_service/local/localTrainingService.ts +++ b/ts/nni_manager/training_service/local/localTrainingService.ts @@ -256,11 +256,11 @@ class LocalTrainingService implements TrainingService { } tkill(trialJob.pid, 'SIGTERM'); const pid = trialJob.pid; - setTimeout((pid: number) => { - if (isAlive(pid)) { - tkill(pid, 'SIGKILL'); - } - }, 5 * 1000, pid); + setTimeout(((pid: number) => { + tkill(pid, 'SIGKILL', (err) => { + this.log.warning(`cancel trial job {pid: ${pid}} failed: ${err?.message}`); + }); + }).bind(this), 5 * 1000, pid); this.setTrialJobStatus(trialJob, getJobCancelStatus(isEarlyStopped));