Snakemake-Profiles / slurm

Cookiecutter for snakemake slurm profile
MIT License
126 stars 44 forks source link

How to specify --output= Slurm parameter? #90

Closed holtgrewe closed 2 years ago

holtgrewe commented 2 years ago

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

jdblischak commented 2 years ago

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

percyfal commented 2 years ago

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.