From b660640e792671e78ffe4e042ee224cb2e1ba1a1 Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Tue, 28 Oct 2025 12:24:27 +0100 Subject: [PATCH 1/2] Add consistent cleanup suggestion --- workflow/salloc/main_salloc_workflow.yaml | 19 +++++++++---------- workflow/salloc/salloc_subworkflow.yaml | 10 ++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/workflow/salloc/main_salloc_workflow.yaml b/workflow/salloc/main_salloc_workflow.yaml index 10de977..2166313 100644 --- a/workflow/salloc/main_salloc_workflow.yaml +++ b/workflow/salloc/main_salloc_workflow.yaml @@ -14,10 +14,12 @@ jobs: hello1: ssh: remoteHost: ${{inputs.resource}} - needs: - - allocate steps: - run: | + while [ ! -f /tmp/slurm_allocation_info.txt ]; do + echo "Waiting for file /tmp/slurm_allocation_info.txt to be created" + sleep 5 + done JOBID=$(grep '^SLURM_JOB_ID=' /tmp/slurm_allocation_info.txt | cut -d= -f2) srun --jobid=$JOBID echo "hello world 1 on $(hostname)" hello2: @@ -27,16 +29,13 @@ jobs: - allocate steps: - run: | + while [ ! -f /tmp/slurm_allocation_info.txt ]; do + echo "Waiting for file /tmp/slurm_allocation_info.txt to be created" + sleep 5 + done JOBID=$(grep '^SLURM_JOB_ID=' /tmp/slurm_allocation_info.txt | cut -d= -f2) srun --jobid=$JOBID echo "hello world 2 on $(hostname)" - relinquish: - ssh: - remoteHost: ${{inputs.resource}} - needs: - - hello1 - - hello2 - steps: - - run: scancel $JOBID + 'on': execute: inputs: diff --git a/workflow/salloc/salloc_subworkflow.yaml b/workflow/salloc/salloc_subworkflow.yaml index 2161385..a978518 100644 --- a/workflow/salloc/salloc_subworkflow.yaml +++ b/workflow/salloc/salloc_subworkflow.yaml @@ -1,4 +1,14 @@ jobs: + release_allocation: + ssh: + remoteHost: ${{inputs.resource.ip}} + steps: + - name: Release Slurm Allocation + run: sleep inf + cleanup: | + JOBID=$(grep '^SLURM_JOB_ID=' $(pwd)/slurm_allocation_info.txt | cut -d= -f2) + scancel $JOBID + allocation: ssh: remoteHost: ${{inputs.resource.ip}} From 879eeb1d386b6ae8c7ab966f6f91e13ee41f61f0 Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Tue, 28 Oct 2025 12:35:45 +0100 Subject: [PATCH 2/2] Add consistent cleanup suggestion --- workflow/salloc/main_salloc_workflow.yaml | 8 ++++++++ workflow/salloc/salloc_subworkflow.yaml | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/workflow/salloc/main_salloc_workflow.yaml b/workflow/salloc/main_salloc_workflow.yaml index 2166313..85a20c1 100644 --- a/workflow/salloc/main_salloc_workflow.yaml +++ b/workflow/salloc/main_salloc_workflow.yaml @@ -35,6 +35,14 @@ jobs: done JOBID=$(grep '^SLURM_JOB_ID=' /tmp/slurm_allocation_info.txt | cut -d= -f2) srun --jobid=$JOBID echo "hello world 2 on $(hostname)" + relinquish: + ssh: + remoteHost: ${{inputs.resource}} + needs: + - hello1 + - hello2 + steps: + - run: touch RELEASE_ALLOCATION 'on': execute: diff --git a/workflow/salloc/salloc_subworkflow.yaml b/workflow/salloc/salloc_subworkflow.yaml index a978518..b40712c 100644 --- a/workflow/salloc/salloc_subworkflow.yaml +++ b/workflow/salloc/salloc_subworkflow.yaml @@ -4,7 +4,11 @@ jobs: remoteHost: ${{inputs.resource.ip}} steps: - name: Release Slurm Allocation - run: sleep inf + run: | + while [ ! -f RELEASE_ALLOCATION ]; do + echo "$(date) Waiting for RELEASE_ALLOCATION file to release the allocation" + sleep 5 + done cleanup: | JOBID=$(grep '^SLURM_JOB_ID=' $(pwd)/slurm_allocation_info.txt | cut -d= -f2) scancel $JOBID