Skip to content

Process recursion considers topic channels for cardinality of outputs #7222

@OlivierCoen

Description

@OlivierCoen

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions