Skip to content

How to execute several processes sequentially, with channels in DSL2? #3415

Answered by mribeirodantas
satish15625 asked this question in Q&A
Discussion options

You must be logged in to vote

Adding maxForks 1 as a process directive will make your tasks run one by one, with no implicit parallelization. If you run the code below, you'll probably see 3 tasks concluding simultaneosly, then 6, 9 and 10. If you set maxForks 1 (now it's maxForks 3), you'll see 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 because it is run sequentially.

process FOO {
  maxForks 3
  input:
    val number
  script:
  """
  echo $number
  sleep 1
  """
}

workflow {
  Channel
    .of(1..10)
  | FOO
}

Replies: 2 comments 1 reply

Comment options

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

Answer selected by mribeirodantas
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