From 06f9f7692f152bd0e317d794d927d0c912208517 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Fri, 3 Jul 2026 10:46:16 +0300 Subject: [PATCH] Added scancel based on job name in the case the workflow gets cancelled while the sbatch job is in queue (in such a case the slurm job id will not have been saved yet --- .github/workflows/make_sbatch_job.sh | 4 ++-- .github/workflows/test_compare_images.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make_sbatch_job.sh b/.github/workflows/make_sbatch_job.sh index 99ce11d1..1d868e7b 100755 --- a/.github/workflows/make_sbatch_job.sh +++ b/.github/workflows/make_sbatch_job.sh @@ -7,8 +7,8 @@ fi #if sbatch fails as it gets the error code from python it tries to print the log # first with srun (in case the file has not yet updated on the front end) # second if srun fails (in case communication failure) it tries to cat it on the frontend (may be empty if file has not been updated pyproject) - -sbatch -W --array=1-$ARRAY_SIZE -o "$1" ./testpackage/$1.sh $2 > jobid_$1 || true +export "TP_PID=$$" >> $GITHUB_OUTPUT +sbatch -W --array=1-$ARRAY_SIZE -o "$1" -J "CI_$$" ./testpackage/$1.sh $2 > jobid_$1 || true #in case we do exit 0 successfully LOG=$(srun cat $1 || cat $1) diff --git a/.github/workflows/test_compare_images.yml b/.github/workflows/test_compare_images.yml index dcc554b5..46ed9fbf 100644 --- a/.github/workflows/test_compare_images.yml +++ b/.github/workflows/test_compare_images.yml @@ -132,6 +132,7 @@ jobs: - name: scancel dangling job upon cancellation if: cancelled() run: | + scancel -n "TP_${{ steps.run_cl.outputs.TP_PID }}" --user $(whoami) scancel ${{ steps.run_cl.outputs.SLURM_JOB_ID }}