Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

slurm - Snakemake and sbatch

I have a Snakefile that has a rule which sends 7 different shell commands. I want to run each of these shell commands in sbatch and I want them to run in different slurm nodes. Right now when I include sbatch inside the shell command in the Snakemake rule I do not get the desired output file because it takes awhile to run and when sbatch returns the command is still running. I think Snakemake thinks that I don't have the required output file because it thinks that the command "finished executing" before the submitted job completed.

What can I do to submit each rule in one slurm node using sbatch command in Snakemake file

question from:https://stackoverflow.com/questions/65861815/snakemake-and-sbatch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I suspect that what you are doing is:

rule one:
    input:
        ...
    output:
        ...
    shell:
        """
        sbatch [sbatch-options] "some-command-or-script"
        """

What you want maybe is:

rule one:
    input:
        ...
    output:
        ...
    shell:
        """
        some-command-or-script
        """

To be executed as

snakemake --cluster "sbatch [sbatch-options]"

In this way every rule will send its jobs to the cluster and snakemake will handle them. If you want a rule to execute its jobs locally (not via sbatch) mark that rule with the directive localrule (check documentation for more detail)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...