fix: quote jobid passed to status script to support multi-cluster Slurm setup #1459
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This is a resubmission of my previous PR #977. I closed it temporarily and rebased it onto main, but since I force pushed it I couldn't re-open it. I apologize for the extra noise. This is a minor fix that comes with a test, and I think is a nice complement to the recent cluster feature updates (e.g.
cluster-cancel
) and the Slurm overhaul in PR #1015I'm a first-time contributor but long-time user, so I wanted to start by saying: Snakemake is awesome! I really appreciate all the effort to develop and maintain this awesome resource.
Description
Motivation
I am trying to use
--cluster-status
with a multi-cluster Slurm setup. To check the status of the job, bothsacct
andscontrol
require the jobid and the name of the cluster. When I use thesbatch
option--parsable
, it returns both in the formatjobid;cluster_name
. This entire string gets passed to the custom script I pass to--cluster-status
, which is great since it provides all the information that the script requires. The problem is that the string isn't quoted, thus the semicolon delimiter is misinterpreted as the end of a line. Thus the shell attempts to execute the name of the cluster. I discovered this behavior with Snakemake 6.2.1.This happens because the first argument passed to the cluster status script isn't quoted:
snakemake/snakemake/executors/__init__.py
Lines 1078 to 1086 in b3c4e68
Proposed solution
This PR quotes the jobid string passed as the first argument to the cluster status script. I confirmed it works both in a standard Slurm setup (i.e. when
--parsable
returns only the job id) and also when specifying the cluster name with--clusters
.QC
docs/
) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).