Skip to content

Commit a21a33e

Browse files
Remove temporary slurm resume file at the end of resume_program
Prior this commit, the code only had `trap "rm -f ${SLURM_RESUME_FILE_TMP}" EXIT`, which works fine for the script until the `sudo -u` happens. When using `sudo -u` to run a command, it creates a new process with a different user context. The trap that was set in the parent shell does not carry over to this new process. Therefore, when the script ends through the sudo command, the EXIT trap in the original shell never gets executed. Therefore, this commit add another removal of temporary file at the end of the script Signed-off-by: Hanwen <[email protected]>
1 parent 6c83475 commit a21a33e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cookbooks/aws-parallelcluster-slurm/templates/default/slurm/resume_program.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ chgrp <%= node['cluster']['cluster_admin_slurm_share_group'] %> ${SLURM_RESUME_F
1313
chmod g+r ${SLURM_RESUME_FILE_TMP}
1414

1515
sudo -u <%= node['cluster']['cluster_admin_user'] %> SLURM_RESUME_FILE=${SLURM_RESUME_FILE_TMP} <%= node_virtualenv_path %>/bin/slurm_resume "$@"
16+
17+
rm -f ${SLURM_RESUME_FILE_TMP}

0 commit comments

Comments
 (0)