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

Remove exit statements #982

Merged
merged 6 commits into from
Mar 31, 2023
Merged

Conversation

FriederikeHanssen
Copy link
Contributor

@FriederikeHanssen FriederikeHanssen commented Mar 29, 2023

Close #805

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs- [ ] If necessary, also make a PR on the nf-core/sarek branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@github-actions
Copy link

github-actions bot commented Mar 29, 2023

nf-core lint overall result: Passed ✅

Posted for pipeline commit 4b6689b

+| ✅ 151 tests passed       |+
#| ❔   9 tests were ignored |#

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 2.7.2
  • Run at 2023-03-31 10:26:05

lib/WorkflowMain.groovy Outdated Show resolved Hide resolved
@maxulysse
Copy link
Member

Asking a second review by @robsyme for sanity

@FriederikeHanssen FriederikeHanssen linked an issue Mar 30, 2023 that may be closed by this pull request
@FriederikeHanssen FriederikeHanssen marked this pull request as draft March 30, 2023 12:58
@FriederikeHanssen
Copy link
Contributor Author

FriederikeHanssen commented Mar 30, 2023

I think it is ready, but conda 😡 :

CondaError: No package 'conda-forge/linux-64::libgomp-12.2.0-h65d4601_19' found in cache directories.

where does this come from now. Ahhhhhhhhhrgh

@FriederikeHanssen FriederikeHanssen marked this pull request as ready for review March 30, 2023 19:54
@maxulysse
Copy link
Member

That's conda, don't wish to much

@FriederikeHanssen
Copy link
Contributor Author

got one conda test to pass by changing nothing, maybe it depends to which runner it is submitted too?

@@ -4,6 +4,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

import nextflow.Nextflow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it failed with missing nextflow.Nextflow before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this tests is expected to fail

Copy link
Contributor

@robsyme robsyme Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import and qualification with nextflow.error prefix are only necessary in Groovy classes pulled into the classpath via inclusion in the lib directory. Inside nextflow files such as main.nf, or workflows/sarek.nf, the error and exit methods are always in scope, so we can remove the import statement and change all occurrences of Nextflow.error to error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just made a bunch of edits. I tried to batch them up, but I am bad at computers and may have messed it up by including some of them as individual commits. It would be good to squash them before any merge or rebase to dev. Apologies for any extra email/notification noise I may have created in the process :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 I see, thank you for fixing it up ❤️

Copy link
Member

@maxulysse maxulysse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to have that part in a Nextflow script:

import nextflow.Nextflow

@maxulysse
Copy link
Member

Amazing work!!!
Thanks

workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
workflows/sarek.nf Outdated Show resolved Hide resolved
We don't need to `import nextflow.Nextflow` inside Nextflow scripts because the methods are already in scope
@FriederikeHanssen FriederikeHanssen merged commit 2e1e760 into nf-core:dev Mar 31, 2023
@FriederikeHanssen FriederikeHanssen deleted the issue_805 branch March 31, 2023 11:47
@FriederikeHanssen
Copy link
Contributor Author

Hey @robsyme ! I just discussed with @subwaystation on how to apply this to other pipelines, and we noticed that there is yet another System.exit call in the initialise function. can it be replaced the same way as all the others, since this time the exitcode is 0:

System.exit(0)

@subwaystation
Copy link

Hey @robsyme ! I just discussed with @subwaystation on how to apply this to other pipelines, and we noticed that there is yet another System.exit call in the initialise function. can it be replaced the same way as all the others, since this time the exitcode is 0:

System.exit(0)

Also note that in

log.info paramsSummaryLog(workflow, params, log)
there is only a log.info without an actual exit. Just so we don't miss a case.

@FriederikeHanssen
Copy link
Contributor Author

well it appears we have discussed this on slack and my squirrel brain just forgot. For posterity: https://nfcore.slack.com/archives/C04UK9FMKN0/p1680084277233609?thread_ts=1680080487.840229&cid=C04UK9FMKN0

TL;DR: can leave as is or replace with Nextflow.exit(0)

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

Successfully merging this pull request may close these issues.

Avoid use of exit-statements
4 participants