genome-grist
genome-grist copied to clipboard
consider using new resources `tmpdir` for setting TMPDIR
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
anddisk_mb
andtmpdir
. Thetmpdir
resource automatically leads to setting the TMPDIR variable for shell commands, scripts, wrappers and notebooks. When defining memory constraints, it is advised to usemem_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
, seesnakemake --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.