Skip to content

Print workflow outputs on run completion#6875

Open
bentsherman wants to merge 5 commits intomasterfrom
print-workflow-outputs
Open

Print workflow outputs on run completion#6875
bentsherman wants to merge 5 commits intomasterfrom
print-workflow-outputs

Conversation

@bentsherman
Copy link
Member

@bentsherman bentsherman commented Feb 27, 2026

Spun off from #6574

This PR updates OutputDsl to print the workflow outputs at the end of a run.

By default it prints a human-readable summary. You can set -output-format json to output JSON instead.

It has no effect when there is no output block

When combined with -q, it is useful for printing a comprehensive pipeline output that can be passed to downstream operations

@bentsherman bentsherman requested a review from a team as a code owner February 27, 2026 16:03
@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 16cfa4a
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69bda873f04d1c0009f4825a

@pditommaso pditommaso force-pushed the master branch 2 times, most recently from d9fa5cd to d752bc2 Compare February 28, 2026 13:10
@pditommaso
Copy link
Member

This could be useful in several scenarios. Could not make sense to print it by default in human readable manner and use an output format flag to switch to json, similarly to module run?

@bentsherman
Copy link
Member Author

Yes I would be happy to always print something for the output.

The -o option is already used by the run command to specify the output directory, so we would probably call it -output-format

@bentsherman
Copy link
Member Author

@jorgee if I add an -output-format option to the run command then you could reuse it in module run to control the output format like we were saying

@bentsherman bentsherman added this to the 26.04 milestone Mar 11, 2026
@jorgee
Copy link
Contributor

jorgee commented Mar 13, 2026

@jorgee if I add an -output-format option to the run command then you could reuse it in module run to control the output format like we were saying

This will fit perfect for module run.

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman bentsherman force-pushed the print-workflow-outputs branch from 142f8dd to 31e5f90 Compare March 20, 2026 15:04
@bentsherman bentsherman changed the title Add -print-output option to print workflow outputs JSON Print workflow outputs on run completion Mar 20, 2026
@bentsherman
Copy link
Member Author

bentsherman commented Mar 20, 2026

Updated to print human-readable output by default.

This is what it looks like for the output-dsl.nf test:

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

Refining the output:

Outputs:

  /home/bent/projects/nextflow-io/nextflow/tests/checks/output-dsl.nf/results

  samples:
    - {id: sample9, fastqc: log/sample9.fastqc.log, bam: null, bai: null, quant: quant/sample9}
    - {id: sample4, fastqc: log/sample4.fastqc.log, bam: null, bai: null, quant: quant/sample4}
    - {id: sample5, fastqc: log/sample5.fastqc.log, bam: null, bai: null, quant: quant/sample5}
    - {id: sample15, fastqc: log/sample15.fastqc.log, bam: null, bai: null, quant: quant/sample15}
    - {id: sample8, fastqc: log/sample8.fastqc.log, bam: null, bai: null, quant: quant/sample8}
    - {id: sample11, fastqc: log/sample11.fastqc.log, bam: null, bai: null, quant: quant/sample11}
    - {id: sample1, fastqc: log/sample1.fastqc.log, bam: null, bai: null, quant: quant/sample1}
    - {id: sample14, fastqc: log/sample14.fastqc.log, bam: null, bai: null, quant: quant/sample14}
    - {id: sample6, fastqc: log/sample6.fastqc.log, bam: null, bai: null, quant: quant/sample6}
    - {id: sample3, fastqc: log/sample3.fastqc.log, bam: null, bai: null, quant: quant/sample3}
    - ... (90 more items)

  summary:
    - summary_report.html
    - summary_data/data.json
    - summary_data/fastqc.txt

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

pditommaso commented Mar 20, 2026

it looks nice! is it aligned with modules output? or the other way around?

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

It is now 😄

$ nextflow -q module run test/my-test-module --meta.id 42 --id 42 --text input.txt --reads sample.fastq 
Outputs:

  /home/bent/projects/sketches/module-system-example/results

  txt:
    - {id: '42'}
    - out-42.txt

  id: '42'

$ nextflow -q module run test/my-test-module --meta.id 42 --id 42 --text input.txt --reads sample.fastq -output-format json
{
    "txt": [
        {
            "id": "42"
        },
        "/home/bent/projects/sketches/module-system-example/results/out-42.txt"
    ],
    "id": "42"
}

@pditommaso
Copy link
Member

Cool, i'll play hard with modules this w-e

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
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.

3 participants