genome-grist icon indicating copy to clipboard operation
genome-grist copied to clipboard

consider using new resources `tmpdir` for setting TMPDIR

Open bluegenes opened this issue 3 years ago • 0 comments

https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html?highlight=temp#standard-resources

As of v6.5, snakemake supports tmpdir within the resources directive:

Standard Resources

There are three standard resources, for total memory, disk usage and the temporary directory of a job: mem_mb and disk_mb and tmpdir. The tmpdir resource automatically leads to setting the TMPDIR variable for shell commands, scripts, wrappers and notebooks. When defining memory constraints, it is advised to use mem_mb, because some execution modes make direct use of this information (e.g., when using Kubernetes).

Since it would be cumbersome to define such standard resources them for every rule, you can set default values at the terminal or in a profile. This works via the command line flag --default-resources, see snakemake --help for more information. If those resource definitions are mandatory for a certain execution mode, Snakemake will fail with a hint if they are missing. Any resource definitions inside a rule override what has been defined with --default-resources. If --default-resources are not specified, Snakemake uses 'mem_mb=max(2*input.size_mb, 1000)', 'disk_mb=max(2*input.size_mb, 1000)', and 'tmpdir=system_tmpdir'. The latter points to whatever is the default of the operating system or specified by any of the environment variables $TMPDIR, $TEMP, or $TMP as outlined here.

bluegenes avatar Jun 24 '21 16:06 bluegenes