Skip to content

Conversation

bentsherman
Copy link
Member

This PR simplifies the parsing of process inputs in #6381 by applying a refactor that was originally developed for #6368 .

Instead of creating an on-the-fly closure delegate in the process entry handler, it is much simpler to use the process inputs after they are parsed into InParams.

The problem is that the process inputs normally aren't constructed until the process is invoked by a workflow. Instead, we need to construct them when the ProcessDef is constructed.

At the same time, the process config still needs to be applied at invocation, since config settings can use withName selectors which depend on the execution context.

To do this, we factor out several classes from ProcessConfig:

  • ProcessDsl: defines the DSL for inputs, outputs, and directives
  • ProcessConfigBuilder: provides functions for applying process config settings
  • ProcessBuilder base class containing shared logic for these two classes

This allows us to build the ProcessDef and resolve the process body immediately, while still applying the process config only after the process is invoked. It also greatly simplifies the process entry handler.

NOTE: In #6368 , ProcessDsl becomes ProcessDslV1, and a separate ProcessDslV2 is defined for the static type syntax.

pditommaso and others added 12 commits September 4, 2025 22:15
Add support for executing Nextflow processes directly without explicit workflow definitions.

Key Features:
- Single process scripts run automatically: `nextflow run script.nf --param value`
- Multi-process scripts use entry selection: `nextflow run script.nf -entry process:name --param value`
- Automatic command-line parameter mapping to process input channels
- Support for all standard input types: val, path, env, tuple, each
- Comprehensive error handling with helpful suggestions

Implementation:
- Enhanced BaseScript with process entry workflow generation
- Added parameter mapping pipeline with input definition extraction
- Created specialized delegates for parsing compiled process bodies
- Added ScriptMeta methods for single/multi-process detection
- Comprehensive documentation and test coverage

This feature bridges the gap between command-line tools and workflow orchestration,
making Nextflow processes more accessible for direct execution scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Rename ProcessEntryHelper.groovy to ProcessEntryHandler.groovy for clearer naming
- Update all class references in BaseScript.groovy to use ProcessEntryHandler
- Clean separation of process entry execution feature from main BaseScript class
- All functionality preserved: single process auto-execution and multi-process entry selection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
---------

Signed-off-by: Rob Syme <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Co-authored-by: Ben Sherman <[email protected]>
Add defensive null checking for sender thread and workflowId to prevent NullPointerException when onFlowComplete is called after initialization failures in onFlowCreate or onFlowBegin methods.

Signed-off-by: Rob Syme <[email protected]>
Co-authored-by: Ben Sherman <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Base automatically changed from feature/process-entry-execution to master September 11, 2025 18:48
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.

4 participants