Skip to content

Improve support for pipeline chaining#6574

Closed
bentsherman wants to merge 3 commits intomasterfrom
pipeline-chaining
Closed

Improve support for pipeline chaining#6574
bentsherman wants to merge 3 commits intomasterfrom
pipeline-chaining

Conversation

@bentsherman
Copy link
Member

@bentsherman bentsherman commented Nov 15, 2025

This PR adds several features to facilitate pipeline chaining based on workflow inputs/outputs

  • Print JSON representation of workflow outputs at end of run
  • Allow code snippets to implicitly declare params and outputs ?
  • Allow JSON params to be supplied via stdin ?

Demo project: bentsherman/pipeline-chaining-demo

The JSON output is very similar to the lineage record (lid://<workflow-run-hash>#output), so maybe we could use that instead. The lineage record has the advantage of using LIDs for files, but the JSON structure doesn't quite match the params file.

With a bit more magic we could even make the pipeline chain as simple as a Bash pipeline:

# print only output JSON to stdout when params are supplied via stdin
cat params.json | nf run fetchngs | nf run rnaseq --transcriptome [...]

But the main thing for now is the basic reading/writing of inputs/outputs, then enhanced validation with schemas and record types.

@netlify
Copy link

netlify bot commented Nov 15, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 474cc1e
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/697a943624d1a600085ac376

@bentsherman
Copy link
Member Author

bentsherman commented Nov 18, 2025

The problem with the stdin params right now is that in the case of a 3-step chain, the second step blocks to wait for stdin and the third step skips the stdin because it is not "available". This leads to a lock error since the first and third run try to lock the history file.

If I skip the System.in.available() check, then the run hangs when there is actually no stdin.

I'll have to see how composable CLI tools normally handle this. I assume each tool has to initialize stdout before waiting for stdin, in order to signal to the next tool in the pipeline that stdin is coming

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman
Copy link
Member Author

Notes:

  • Printing the workflow outputs JSON seems like a good idea, but probably should be opt-in via CLI option

  • The implicit params / output blocks for code snippets was considered too "magical", and it can't support full type validation. Especially with LLMs writing code, I don't think this is needed

  • Receiving params from stdin is a fun shorthand but not really needed right now

TODO: trim PR scope to just the workflow outputs JSON with CLI option

@bentsherman
Copy link
Member Author

Closing in favor of #6875 . We can revisit if we decide to enable params via stdin

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.

1 participant