nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.61k stars 605 forks source link

Store all .command* log files in log folder #5047

Open trvietdung opened 3 weeks ago

trvietdung commented 3 weeks ago

Hi all,

I would like to store all .command.* files generated by each process into a central log folder. This is nice so that we can keep track of all log files even after removing the work directory.

Looking through the discussions , I found that one solution already exists: nextflow-io/nextflow/issues/1166

When you try to apply it using afterScript, with my nextflow version of nextflow-23.05.0-edge-all, I'm having a problem because the script in afterScript runs before the .command* files are generated

Above is the list of files generated in our $task.workDir

-rw-rw-r-- 1 vtran xxx 0 2024-05-22 17:53:08.247993000 +0200 .command.begin -rw-rw-r-- 1 vtran xxx 0 2024-05-22 17:53:10.679392000 +0200 .command.err -rw-rw-r-- 1 vtran xxx 250 2024-05-22 17:53:18.869016000 +0200 .command.log -rw-rw-r-- 1 vtran xxx 250 2024-05-22 17:53:18.867972000 +0200 .command.out -rw-rw-r-- 1 vtran xxx 10867 2024-05-22 17:53:08.233147000 +0200 .command.run -rw-rw-r-- 1 vtran xxx 149 2024-05-22 17:53:08.235573000 +0200 .command.sh -rw-rw-r-- 1 vtran xxx 228 2024-05-22 17:53:18.774247000 +0200 .command.trace -rw-rw-r-- 1 vtran xxx 1 2024-05-22 17:53:18.872795000 +0200 .exitcode -rw-rw-r-- 1 vtran xxx 3312 2024-05-22 17:53:08.224216000 +0200 taskParams.yml -rw-rw-r-- 1 vtran xxx 2506 2024-05-22 17:53:09.611132000 +0200 versions.yml

The taskParams.yml file is generated in our block the afterScript and the versions.yml in the beforeScript.

The timestamp shows that the function in the afterScript finishes before the beforeScript and the log .command files. So I get errors if I want to use the afterScript to run cp commands to copy .command files.

I'd like to know if the change in the way AfterScript works is permanent or just temporary for this release. And if there is an alternative solution.

Thank you very much!