Repository navigation
Deprecate process when section in favor of process.when config setting - #7746
Merged
Merged
Conversation
✅ Deploy Preview for nextflow-docs canceled.
|
jorgee
approved these changes
Oct 8, 2026
jorgee
left a comment
Contributor
There was a problem hiding this comment.
Looks good. I added a couple of doc suggestions inline, to make clear that when both the when section and the process.when config setting are set, the config setting wins.
One question: the deprecation warning for the when section is only shown by nextflow lint and the editor. nextflow run doesn't print it. Would it be worth also warning at run time, or would that be too noisy, since most nf-core pipelines would get one warning per module?
…tting Signed-off-by: Ben Sherman <bentshermann@gmail.com>
bentsherman
force-pushed
the
process-when-config
branch
from
October 8, 2026 19:33
13c8750 to
ecbb8bd
Compare
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Member
Author
|
Thanks, I added your suggestions while cleaning up the PR. Indeed, we only want to show a lint warning because it is intended for developers rather than users. So users won't get flooded with warnings, but developers will see it when they lint their pipeline code. |
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
stefanoboriero
added a commit
that referenced
this pull request
Oct 9, 2026
Resolve the conflict in ScriptRunnerTest by keeping both the process.when test from #7746 and the awaitShutdown test from this PR. Assisted-by: Claude Code (Claude Opus 5.5) Signed-off-by: Stefano Boriero <stefano.boriero@seqera.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The process
whensection is an anti-pattern when used in place of explicit workflow logic (anifstatement orfilteroperator). Its remaining use case is temporarily disabling a process at runtime, which is how nf-core uses it:Setting
whenin the process config already worked by accident: unknown config settings are copied into the process config, andTaskConfig.getWhenGuard()evaluates them like awhen:section. This PR makes that official and deprecates thewhensection.Changes
whento theprocessconfig scope spec (not to process directives or theagentscope), so it can only be set in configwhenas an unknown directive inProcessConfigBuilderwhensection inScriptAstBuilder(typed and legacy processes), replacing the type checker soft error and the paranoid warningwhensection from Discouraged to Deprecated on the deprecations page, 26.10 migration noteswhencan be a boolean or a closure that is evaluated per task, with access to task inputs and params:process { withName: 'FASTQC' { when = { meta.id != params.skip_sample } } }Caveat (documented): disabling a process that emits dataflow values produces empty dataflow values, which will likely break the run.
Compatibility
Setting
whenin the process config already works in Nextflow 24.10 (tested with 24.10.0), including closures andwithNameselectors that override awhensection in the script. Older versions just print anUnknown directive `when`warning for each process. Pipelines can therefore migrate fromext.whentowhenwithout raising their minimum Nextflow version.