Skip to content

Snakemake fails to parse sbatch output to get slurm_jobid #146

Open
@kennethabarr

Description

@kennethabarr

On my system slurm reports submission info even at the lowest level of verbosity. I.e.

> sbatch script.sh
sbatch: Verify job submission ...
sbatch: Using a shared partition ...
sbatch: Partition: X
sbatch: QOS-Flag: X
sbatch: Account: X
sbatch: Verification: ***PASSED***
Submitted batch job 23401073

This leads to problems parsing the jobid. This cannot be resolved with --quiet because then the job id is not returned either. The lines beginning with "sbatch: " are printed to stderr, while the jobid is printed to stdout, but in the code these are mixed on init.py:207

out = subprocess.check_output(
                call, shell=True, text=True, stderr=subprocess.STDOUT
            )

It is not an elegant solution, but I have modified my init.py by adding a line to subset the variable out to only the last line. This restores the proper behavior and my pipelines run normally.

out = out.splitlines()[len(out.splitlines())-1].strip()

The versions I am using are as follows:
snakemake version 8.18.2
slurm executor version 0.10.0
slurm version 20.11.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions