scratch
The scratch directive executes each task in a temporary directory that is local to the compute node.
Usage
This is useful when executing tasks on an executor with a shared filesystem, because it decreases the network overhead of reading and writing files. Only the files declared as process outputs are copied to the pipeline work directory.
For example:
process hello {
scratch true
output:
path 'data_out'
script:
"""
your_command --here
"""
}
You can also set it in the Nextflow configuration:
process.scratch = true
By default, the scratch directive uses the $TMPDIR environment variable in the underlying node as the base scratch directory. If $TMPDIR is not defined, then it creates a scratch directory using the mktemp command.
Each task creates a subdirectory within the base scratch directory and automatically deletes it upon completion.
Cloud-based executors enable scratch by default because the pipeline work directory resides in object storage.
Options
The following values are available: Do not use a scratch directory. Create a scratch directory in the directory defined by the Create a scratch directory in the directory defined by the given environment variable, or Create a scratch directory in the specified directory. Create a scratch directory in the RAM disk falsetrue$TMPDIR environment variable, or $(mktemp /tmp) if $TMPDIR is not set.'$YOUR_VAR'$(mktemp /tmp) if that variable is not set. The value must use single quotes, otherwise the environment variable is evaluated in the pipeline script context.'/my/tmp/path''ram-disk'/dev/shm/.