Method call from within process routes output to wrong process instance

I have a process filter_contacts which, in the shell section, passes its inputs to a Groovy method assemble_filter_contacts_proc_cmd. The assemble_filter_contacts_proc_cmd method uses those inputs to build a string that becomes the final string in the shell section and is called as the process command.

I structured it this way because I wanted to be able to build the process command and display it in the stub section for the sake of convenience, since the logic to build the command is complex and I wanted to make sure I was getting it right.

The problem is that when I actually ran the code, the 8 instances of filter_contacts would each call assemble_filter_contacts_proc_cmd, but the outputs of assemble_filter_contacts_proc_cmd would get passed back to the wrong instance of the filter_contacts process.

To check, I would build a string in the body of the filter_contacts shell section that calls println("${sample_id} ${filename} ${cmd}") after cmd was built by assemble_filter_contacts_proc_cmd. The sample_id and filename displayed in the first part of the output from println would often not match the sample_id and filename embedded in the cmd string. In the work directory, the appropriate input file would be present, and sample_id mismatched output filenames would be created.

This problem was resolved by copy/pasting the body of the assemble_filter_contacts_proc_cmd method into the body of the filter_contacts process.

Should I submit this as a github bug report, or is there some sort of intrinsic problem with calling Groovy methods from within processes?

Thank you!

Can you share a minimal reproducible example, please?

I don’t know if I have one, unfortunately. The actual example is a full workflow that I’m running on a large dataset on an HPC cluster with a decent amount of branching cache-and-resume steps.

Using a function to build the script should work, though there might be some quirk that needs to be ironed out. If you could show a minimal version of filter_contacts and the builder function, I can look into it