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

Add function to exit cleanly #3984

Open
ewels opened this issue May 30, 2023 · 1 comment
Open

Add function to exit cleanly #3984

ewels opened this issue May 30, 2023 · 1 comment
Labels

Comments

@ewels
Copy link
Member

ewels commented May 30, 2023

New feature

In order for Nextflow to play nicely in managed environments, we need to avoid using System.exit calls, and the recently depreciated exit() Nextflow function.

For problems with pipeline execution, we can use the error() Nextflow function, however there is no equivalent for exiting cleanly if we just want to stop without any problems.

Usage scenario

Example current usage of exit 0 in nf-core pipelines, after printing usage information to the terminal:

if (params.help) {
   log.info paramsHelp("nextflow run my_pipeline --input input_file.csv")
   exit 0
}

Suggest implementation

Equivalent of error() but with exit code 0 and no terminal output. Any supplied strings should not be coloured red.

@bentsherman
Copy link
Member

Seems like we should just modify exit() to throw a special type of exception instead of System.exit(). That way all the nf-core pipelines will just start using it.

The ScriptRunner could handle this special exception by cancelling the session instead of re-throwing the error.

@stale stale bot added the stale label Dec 15, 2023
@nextflow-io nextflow-io deleted a comment from stale bot Dec 17, 2023
@stale stale bot removed the stale label Dec 17, 2023
@ewels ewels added the pinned label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants