8

Is it possible to restrict number of jobs to run by a particular rule in snakemake? --jobs controls globably how many jobs are allowed to run at a time, but I would like to restrict by a specific rule.

This is because, I have a particular rule that can be used at most for two jobs in parallel. However, if I set --jobs to 20, this results in tool in that particular rule crashing. I use snakemake v5.2.0 in LSF cluster.

Manavalan Gajapathy
  • 3,900
  • 2
  • 20
  • 43

1 Answers1

11

You could probably use resources.

Define them in a rule

rule only_two:
    ...
    resources:
        load=50
    ...

and then run snakemake with a certain resource limit.

snakemake --resources load=100

It should only run two instances of rule only_two.

All other rules might have a load value of 1 or less and you could run 100 or more of them simultaneously.

https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#resources

Jan Schreiber
  • 203
  • 2
  • 7