Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 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 Answer

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...