Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withTrace nf-test option redundant with nextflow.config #247

Open
birnbera opened this issue Aug 22, 2024 · 0 comments
Open

withTrace nf-test option redundant with nextflow.config #247

birnbera opened this issue Aug 22, 2024 · 0 comments

Comments

@birnbera
Copy link

Hello! As always, thank you for the excellent work on this tool. It's really taken Nextflow development to the next level (😝).

However, I'd like to suggest a change to the config. Currently, it supports a boolean option, withTrace, to indicate whether to perform tracing. It seems that the option was added in response to #9 to support situations when procps is not available. When set to true, nf-test sets --with-trace trace.csv on the Nextflow CLI command.

This causes two issues, one is that it overrides the trace settings in the project nextflow.config and test nextflow.config (i.e., the one pointed to by nf-test.config). So even if the trace file is expected to have a different name or location, since CLI options have the highest priority the trace is saved as trace.csv (which is actually a misnomer since it's tab-separated by default). In my case, I have custom logic in an onComplete closure that expects a specific filename and structure for the trace file as defined in nextflow.config, which throws an error when the file isn't found (although the tests still pass since a failing event closure doesn't cause the workflow to fail).

Relatedly, the withTrace option is redundant since you can put the same config in the test-specific nextflow.config. When #9 was raised, I think this would have been a more natural solution. Although, I believe that the current behavior was designed so that nf-test knows where to find and how to parse the trace file so that workflow.trace works.

My suggestion is to deprecate this option in favor of recommending users use the test folder nextflow.config to configure tracing for tests differently from production runs. And rather than hardcoding the trace file name and location, let users specify the name to look for in nf-test.config and/or allow per test specification. Then, throw an error if a test tries to access workflow.trace when no trace file was found.

For my onComplete closure testing problem, I know of two workarounds:

  1. Disable the onComplete closure by setting workflow.onComplete = {}. This kind of works, but makes it impossible to test aspects of the onComplete behavior.
  2. Set withTrace = false in nf-test.config. This allows the included nextflow.config from the project to control tracing, which then allows the onComplete closure to run successfully. However, this disables workflow.trace, which makes other kinds of testing more challenging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant