Nextflow, disabling trap command

For each process, Nextflow creates a working directory and creates a collection of hidden files to run the job (e.g. .command.begin, .command.log, etc). The .command.run is a bash script that contains nthe commands to execute the process as a job. In this file, we noticed under nxf_main() function there are three trap commands:

trap on_exit EXIT
trap on_term TERM INT USR2
trap ‘’ USR1

We have found that the last trap command, “trap ‘’ USR1”, is causing an issue for our pipeline. We found a hack to overcome this issue, but I am wondering if anyone knows of a way to control which trap commands are included in the .command.run script? Either via optional flags or maybe a configuration file? Or are these just hard coded into a template file?

I took a deeper dive into the Nextflow Github repository. The .command.run file is generated from a template file command-run.txt. Source:

The file itself is found in the link below. The trap commands are found under function nxf_main (Line 131), which are part of the template.

1 Like