Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix: quote jobid passed to status script to support multi-cluster Slu…
…rm setup (#1459) * fix: quote jobid passed to status script to support multi-cluster setup Motivation: In a multi-cluster Slurm setup, i.e. passing the flag `--clusters` to `sbatch`, then the job id returned with the `--parsable` flag is actually `jobid;cluster_name`. This breaks a custom status script because the shell ends the command at the semi-colon. This PR quotes `jobid;cluster_name` so that a custom status script could then parse this input to obtain the job status from the specified cluster_name and jobid. * Add a test for multi-cluster status script Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
- Loading branch information
1 parent
ef0475c
commit 0232201
Showing
6 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/test_cluster_statusscript_multi/Snakefile.nonstandard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from snakemake import shell | ||
|
||
envvars: | ||
"TESTVAR" | ||
|
||
|
||
|
||
rule all: | ||
input: 'output.txt' | ||
|
||
rule compute: | ||
output: 'output.txt' | ||
shell: 'touch {output}' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
echo `date` >> sbatch.log | ||
tail -n1 $1 >> sbatch.log | ||
# simulate printing of job id by a random number plus the name | ||
# of the cluster | ||
echo "$RANDOM;name-of-cluster" | ||
cat $1 >> sbatch.log | ||
sh $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# The argument passed from sbatch is "jobid;cluster_name" | ||
|
||
arg="$1" | ||
jobid="${arg%%;*}" | ||
cluster="${arg##*;}" | ||
|
||
echo success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters