Direct execution of named (typed) workflows (module run) - #7379
Draft
jorgee wants to merge 1 commit into
Draft
Conversation
Enable running a single named, statically-typed workflow directly. This backs `nextflow module run scope/name` for workflow modules and `nextflow run script.nf` for a single-workflow script. Ported from PR #7208. - nf-lang ScriptToGroovyVisitor: lower each workflow take with its declared type (`_take_(name, type)`) so take types are available at runtime. - WorkflowDef/WorkflowParamsDsl: record take types and expose getDeclaredInputTypes(); untyped takes (Object) are omitted. - ScriptMeta.hasExecutableWorkflows(): a non-module script with exactly one named workflow. - BaseScript.run0(): when no entry is selected, synthesize an entry via WorkflowEntryHandler for a single named workflow, else fall back to the process entry handler; a multi-workflow script still reports "No entry workflow specified". - WorkflowEntryHandler: map `--<take>` params to workflow inputs using the declared types (Channel<T> loads a CSV/JSON/YAML samplesheet or wraps a collection; Value<T> becomes a value channel; scalars are coerced), invoke the workflow, and publish its emits. Guarded to typed workflows only. Outputs currently reuse the existing OutputDsl publishing; the no-output-dir / index-file behaviour and typed-record samplesheet loading are follow-ups. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: jorgee <jorge.ejarque@seqera.io>
✅ Deploy Preview for nextflow-docs canceled.
|
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.
Enable running a single named, statically-typed workflow directly, without writing an explicit entry workflow. This is the execution primitive behind
nextflow module run scope/namefor workflow modules, and it also applies to a localnextflow run script.nfthat defines exactly one named workflow.What it does
Given a script with a single named, typed workflow:
Nextflow synthesizes an entry workflow that maps
--<take>params to the workflow inputs, invokes it, and publishes itsemit:channels as outputs.Changes
ScriptToGroovyVisitor— lower each workflow take with its declared type (_take_(name, type)) so take types are available at runtime.WorkflowDef/WorkflowParamsDsl— record take types and exposegetDeclaredInputTypes(); untyped takes (Object) are omitted.ScriptMeta.hasExecutableWorkflows()— a non-module script with exactly one named workflow.BaseScript.run0()— when no entry is selected, synthesize an entry viaWorkflowEntryHandlerfor a single named workflow, else fall back to the process entry handler; a multi-workflow script still reports "No entry workflow specified".WorkflowEntryHandler(new) — maps--<take>params to inputs using the declared types:Channel<T>→ load a samplesheet file (CSV / JSON / YAML) or wrap a collection withchannel.fromList;Value<T>→ value channel;String/Integer/Path/…) → coerced value.Then invokes the workflow and publishes its emits. Typed workflows only (guarded by
isTypingEnabled()).Not in this PR (follow-ups)
OutputDslpublishing (as the process entry handler does); the ADR's no-output-directory / work-dir-path index-file behaviour is a follow-up.Maps; casting each row to a customrecordtype (Channel<Sample>) is a follow-up (the__Params-class TODO from Direct execution for named workflows #7208).Testing
WorkflowEntryHandlerTest(samplesheet loading for CSV/JSON/YAML, param→take resolution by type, guards). Fullnextflow.script.*andnf-langsuites pass.Channel<Map>samplesheet take + a scalarStringtake vianextflow module run ./mod --greetings sheet.csv --prefix Hi→ outputs published; verified the scalar is passed as a value and the CSV becomes a channel.Co-authored from PR #7208 by @bentshermann.