Snakemake-Profiles/slurm

How to specify --output= Slurm parameter?

Closed this issue · 2 comments

Is there a way to specify the --output= parameter of Slurm?

I was able to specify --output and --job-name by including the following in slurm-submit.py:

SBATCH_DEFAULTS = """
job-name=smk-{rule}-{wildcards}
output=logs/{rule}/{rule}-{wildcards}-%j.out
"""

But that was with an older version of the cookiecutter template. I did it again with the latest version from 2021-03-10, this time specifying the sbatch_defaults during the setup, and they were added to settings.json

$ cookiecutter https://github.com/Snakemake-Profiles/slurm.git
profile_name [slurm]:
sbatch_defaults []: job-name=smk-{rule}-{wildcards} output=logs/{rule}/{rule}-{wildcards}-%j.out
Select advanced_argument_conversion:
1 - no
2 - yes
Choose from 1, 2 [1]: 1
cluster_name []:
cluster_config_help [The use of cluster-config is discouraged. Rather, set snakemake CLI options in the profile configuration file (see snakemake documentation on best practices). Enter to continue...]:
cluster_config []:

$ cat slurm/settings.json
{
    "SBATCH_DEFAULTS": "job-name=smk-{rule}-{wildcards} output=logs/{rule}/{rule}-{wildcards}-%j.out",
    "CLUSTER_NAME": "",
    "CLUSTER_CONFIG": "",
    "ADVANCED_ARGUMENT_CONVERSION": "no"
}

xref: #29, #40, #43

Yes, the way to set output, error and other sbatch-specific arguments is via the SBATCH_DEFAULTS variable, either in slurm-submit.py for older versions of the cookiecutter, now in settings.json.