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

Commit

Permalink
[Job Debugging] If user command's exitcode is none zero, container wi…
Browse files Browse the repository at this point in the history
…ll be reserved. (#2225)
  • Loading branch information
ydye authored Feb 28, 2019
1 parent 590b4da commit 7410b3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rest-server/src/models/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ class Job {
'azRDMA': azureEnv.azRDMA === 'false' ? false : true,
'paiMachineList': paiConfig.machineList,
'reqAzRDMA': data.jobEnvs && data.jobEnvs.paiAzRDMA === true ? true : false,
'isDebug': data.jobEnvs && data.jobEnvs.isDebug === true ? true : false,
});
return dockerContainerScript;
}
Expand Down
9 changes: 9 additions & 0 deletions src/rest-server/src/templates/dockerContainerScript.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ else
wait $user_command_pid
user_command_exitcode=$?
echo "job has finished with exit code $user_command_exitcode"
{{# isDebug }}
if [[ $user_command_exitcode -ne 0 ]]; then
echo "============================================================================="
echo "====== The job container failed, so it will be reserved for 1 week ======"
echo "====== After debugging, please stop the job manually. ======"
echo "============================================================================="
sleep 604800
fi
{{/ isDebug }}
exit $user_command_exitcode
fi

0 comments on commit 7410b3d

Please sign in to comment.