Skip to content

How to wait for process to finish before starting the next #3623

Discussion options

You must be logged in to vote

If you collect with flat: false and use the flatMap channel operator afterward you should get the waiting desired effect and at the same time have the channel in its original output structure. Check the example below:

process FOO {
  input:
    val x
  output:
    tuple val(y), val(z)
  exec:
    y = x+1
    z = y*2
}

workflow {
  Channel
    .of(1..10)
    | FOO
    | collect(flat: false)
    | flatMap
    | view
}

Output:

N E X T F L O W  ~  version 22.10.6
Launching `hehe.nf` [mighty_ardinghelli] DSL2 - revision: 72de2b765e
executor >  local (10)
[23/ec3933] process > FOO (10) [100%] 10 of 10 ✔
[8, 16]
[3, 6]
[7, 14]
[4, 8]
[9, 18]
[5, 10]
[6, 12]
[2, 4]
[10, 20]
[11, 22]

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@mribeirodantas
Comment options

Answer selected by Apompetti-Cori
Comment options

You must be logged in to vote
1 reply
@mribeirodantas
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants