Hi Paolo,
thanks for your reply Paolo.
My point was not clear.
If using "scratch = true" then the /tmp ( or $TMPDIR ) is used and there is a possibility that the underlying resource manager takes care to deleted at some point, as you described. But control of this system behavior looks to me out of scope of a workflow developer.
If using "scratch = /some/scratch/directory " I do not observe ( at least in SGE) that mktemp created directories are deleted automatically after some time.
I adapted your snippet to
process {
scratch = true
afterScript = 'rm -rf $NXF_SCRATCH'
}
that does what i expected to happen.
In order to keep resources clean, and that scratch temp directories are not traceable (i.e. on trace file there is no link to that file, and accessing cluster resources might be tricky ) you might consider to delete them after the calculations.
It is also fine to do it via afterScript, but some reference in documentation could help.