nextflow-io / nextflow-io/nextflow

Process recursion considers topic channels for cardinality of outputs

Open
#7,222 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang/processes
Dominant language
Groovy
Stars
3.5k
Forks
811
Avg merge
2d 11h
Merged PRs (30d)
61

Description

Bug report

Expected behavior and actual behavior

Topic channels are counted as actual outputs for processes included in a recursion loop. This is a problem for topic channels, in particular for tool versioning.

Steps to reproduce the problem

Here is a little test workflow to reproduce the error:

nextflow.preview.recursion=true

process INIT {

  output:
    path 'result.txt'
  script:
    """
    echo "a" > result.txt
    """
}

process FOO {
  input:
    path 'input.txt'
  output:
    path 'result.txt', emit: text
    val("a"),          topic: test
  script:
    """
    cat input.txt > result.txt
    echo "Task ${task.index} was here" >> result.txt
    """
}

workflow {

  INIT()

  FOO
    .recurse(INIT.out)
    .times(10)

  FOO
    .out.text
    .view()
}

The script fails with the error:
Process FOOinputs and outputs do not have the same cardinality - Feedback loop is not supported but works well by commenting theval("a"), topic: test` line.

Environment
  • Nextflow version: 26.04.03
  • Java version: openjdk 17.0.10 2024-01-16
  • Operating system: Ubuntu 24.04
  • Bash version: zsh 5.9 (x86_64-ubuntu-linux-gnu)

Thanks a lot in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied workflow using nextflow.preview.recursion=true and reproduce the cardinality error when FOO declares the topic output. Trace the recursion feedback-loop cardinality check for process inputs and outputs; done means the workflow runs with the topic channel present while preserving the existing output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.