above mem_mb=100 in rule a means that any job from rule a will require 100 megabytes of memory in total, and not per thread). Resources are always meant to be specified as total per job, not by thread (i.e. The scheduler will ensure that the given resources are not exceeded by running jobs. In addition to threads, a rule can use arbitrary user-defined resources by specifying them with the resources-keyword: It is also possible to refer to a predefined variable (e.g, threads: threads_max) so that the number of cores for a set of rules can be changed with one change only by altering the value of the variable threads_max. The signature of the callable should be callable(wildcards) (input is an optional parameter). Starting from version 3.7, threads can also be a callable that returns an int value. Snakemake will always round the calculated value down (while enforcing a minimum of 1 thread). E.g., in the above example, we reserve 75% of the given cores for the rule. The number of given cores is globally available in the Snakefile as an attribute of the workflow object: res.Īny arithmetic operation can be performed to derive a number of threads from this. Rule NAME : input : "path/to/inputfile", "path/to/other/inputfile" output : "path/to/outputfile", "path/to/another/outputfile" shell : "somecommand " Integrating foreign workflow management systems.Onstart, onsuccess and onerror handlers.Ensuring output file properties like non-emptyness or checksum compliance.