Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 10 additions & 3 deletions workflow/salloc/main_salloc_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -27,6 +29,10 @@ 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:
Expand All @@ -36,7 +42,8 @@ jobs:
- hello1
- hello2
steps:
- run: scancel $JOBID
- run: touch RELEASE_ALLOCATION

'on':
execute:
inputs:
Expand Down
14 changes: 14 additions & 0 deletions workflow/salloc/salloc_subworkflow.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
jobs:
release_allocation:
ssh:
remoteHost: ${{inputs.resource.ip}}
steps:
- name: Release Slurm Allocation
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

allocation:
ssh:
remoteHost: ${{inputs.resource.ip}}
Expand Down