Search code examples
pythonsnakemake

Snakemake: specify cluster per rule


I am running a large workflow in snakemake, that employs cluster execution (--cluster qsub) and a custom profile (--profile custom) for execution in a user-specific computing environment. How can I specify which computing environment (cluster, profile or local) to use for every rule?

Otherwise, would it be possible to chain multiple sub-workflows with different execution options?


Solution

  • Specifying rules for local execution can be done via localrules:

    The keyword localrules allows to mark a rule as local, so that it is not submitted to the cluster and instead executed on the host node

    See docs.

    localrules: all, foo
    
    rule all:
        input: ...
    
    rule foo:
        ...
    
    rule bar:
        ...
    

    AFAIK it's not possible to specify a custom profile per individual rule.