Search code examples
cluster-computingsnakemakedrmaa

Snakemake cluster config in combination with DRMMA


I have a question related to drmma and the cluster config file in snakemake.

Currently i have a pipeline and I submit jobs to the cluster using drmma with the following command:

snakemake --drmaa " -q short.q -pe smp 8 -l membycore=4G" --jobs 100 -p file1/out file2/out file3/out

The problem is that some of the rules/jobs require less or more resources. I though that if i used the json cluster file I would be able to submit the jobs with different resources. My json file looks like this:

{
    "__default__":
    {
        "-q":"short.q",
        "-pe":"smp 1",
        "-l":"membycore=4G"
    },
    "job1":
    {
        "-q":"short.q",
        "-pe":"smp 8",
        "-l":"membycore=4G"
    },
    "job2":
    {
        "-q":"short.q",
        "-pe":"smp 8",
        "-l":"membycore=4G"
    }
}

When I run the following command my jobs (job1 and job2) are submitted with default options and not with the custom ones:

snakemake --jobs 100 --cluster-config cluster.json --drmaa -p file1/out file2/out file3/out

What am I doing wrong? Is it that I cannot combine the drmaa option with the cluster-config file?


Solution

  • the cluster config file simply allows you do define variables that are later used in --cluster/--cluster-sync/--drmaa depending on the defined placeholders. There's no DRMAA specific magic involved here. Have a look at the corresponding section in the documentation again.

    Maybe an example makes things clearer:

    Cluster config:

    {
        "__default__":
        {
          "time" : "02:00:00",
          "mem" : 1G,
        },
        # more rule specific definitions here...
    }
    

    Example snakemake arguments to make use of the above:

     --drmaa " -pe OpenMP {threads} -l mem_free={cluster.mem} -l h_rt={cluster.time}"
    

    or

    --cluster-sync "qsub -sync y -pe OpenMP {threads} -l mem_free={cluster.mem} -l h_rt={cluster.time}"
    

    cluster.time and cluster.mem will be replaced accordingly per rule.

    Andreas