Skip to content

Commit

Permalink
Symlink status-sacct-multi.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jdblischak committed Mar 9, 2022
1 parent 506a104 commit 977f3c9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ post][sichong-post] by Sichong Peng nicely explains this strategy for replacing

* **New** Full support for [multi-cluster setups][multi_cluster] (using a custom
status script requires Snakemake 7.1.1+). See the section [Multiple
clusters][#multiple-clusters] below
clusters](#multiple-clusters) below

## Limitations

Expand Down Expand Up @@ -222,6 +222,9 @@ status of the jobs. You can choose which one you'd like to use:
from the [official profile][slurm-official]. If your HPC cluster doesn't have
`sacct` configured, you can use this option

* `status-sacct-multi.sh` - Support for multi-cluster setup (see section
[Multiple clusters](#multiple-clusters))

To use one of these status scripts:

1. Download the script to your profile directory where `config.yaml` is located
Expand Down
3 changes: 3 additions & 0 deletions examples/multi-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ snakemake --profile simple/
# Confirm the correct cluster was used
cat output/cluster.txt
```

**Note:** The file `simple/status-sacct-multi.sh` is a symlink to the actual
file in `extras/`
19 changes: 0 additions & 19 deletions examples/multi-cluster/simple/status-sacct-multi.sh

This file was deleted.

1 change: 1 addition & 0 deletions examples/multi-cluster/simple/status-sacct-multi.sh
3 changes: 3 additions & 0 deletions extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ Scripts:

* `status-scontrol.sh` - Bash script that uses `scontrol` to determine job
status

* `status-sacct-multi.sh` - Bash script that uses `sacct` to determine job
status in a multi-cluster setup
19 changes: 19 additions & 0 deletions extras/status-sacct-multi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Check status of Slurm job submitted to one of multiple clusters

arg="$1"
jobid="${arg%%;*}"
cluster="${arg##*;}"

output=`sacct --clusters="$cluster" -j "$jobid" --format State --noheader | head -n 1 | awk '{print $1}'`

if [[ $output =~ ^(COMPLETED).* ]]
then
echo success
elif [[ $output =~ ^(RUNNING|PENDING|COMPLETING|CONFIGURING|SUSPENDED).* ]]
then
echo running
else
echo failed
fi

0 comments on commit 977f3c9

Please sign in to comment.