Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

change SIGKILL to SIGTERM in local mode cancel trial job #3173

Merged
merged 7 commits into from
Dec 15, 2020
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ts/nni_manager/training_service/local/localTrainingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,16 @@ class LocalTrainingService implements TrainingService {

return Promise.resolve();
}
tkill(trialJob.pid, 'SIGKILL');
tkill(trialJob.pid, 'SIGTERM');
let waitingTime = 0;
while(await isAlive(trialJob.pid)) {
if (waitingTime > 4999) {
tkill(trialJob.pid, 'SIGKILL');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about add break here, in case pid is not terminated even with sigkill?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIGKILL can not kill process is almost impossible, if it is happened, I think there may have a serious system error. I will add catch error and break in this case.

}
await delay(500);
waitingTime += 500;
}

this.setTrialJobStatus(trialJob, getJobCancelStatus(isEarlyStopped));

return Promise.resolve();
Expand Down