<p>I would guess it is not possible without channels unless you are using <code>beforeScript</code> and <code>afterScript</code>. I came up with this solution:</p>
<pre><code>#!/usr/bin/env nextflow

nextflow.enable.dsl=2

workflow {
  // C(B(A(&quot;&quot;)))

  next = &quot;&quot;
  next = A(next)
  next = B(next)
  next = C(next)
}


process A{
  echo true
  input: val _
  output: val &quot;&quot;

  &quot;&quot;&quot;
  echo $task.process
  &quot;&quot;&quot;
}

process B{
  echo true
  input: val _
  output: val &quot;&quot;

  &quot;&quot;&quot;
  echo $task.process
  &quot;&quot;&quot;
}

process C{
  echo true
  input: val _
  output: val &quot;&quot;

  &quot;&quot;&quot;
  echo $task.process
  &quot;&quot;&quot;
}
</code></pre>
<p>By using workflows you can change the execution order. But it is still a hack and I would prefer something like a <code>next:</code> keyword to specify the next process.</p>
<hr />
<p>And for those not interested in DSL2:</p>
<pre><code>process A {
  echo true

  output:
  val &quot;&quot; into B
  

  &quot;&quot;&quot;
  echo &quot;$task.process&quot;
  &quot;&quot;&quot;
}

process B {
  echo true

  input:
  val _ from B

  output:
  val &quot;&quot; into C

  &quot;&quot;&quot;
  echo &quot;$task.process&quot;
  &quot;&quot;&quot;
}

process C {
  echo true

  input:
  val _ from C

  &quot;&quot;&quot;
  echo &quot;$task.process&quot;
  &quot;&quot;&quot;
}
</code></pre>
<p>Also, I am quite curious to see other solutions.</p>

CC BY-SA 4.0
2022-01-26T16:24:37.903Z
2022-01-26T16:24:37.903Z
kibubu
<p>Using DSL2.</p>
<p>I have processes A, B, C which I want to run in sequence - B waits for A to finish, C waits for B to finish.</p>
<p>They are not communicating via channels so I can't do A.out.collect().</p>
<p>I have tried making dummy channels but this is problematic and a hack. The onComplete subscription doesn't seem to let me trigger another process.</p>
<p>What is the correct way to run a sequence of processes which are not communicating or triggered by channels?</p>
<p>P.S. I am aware that this is not really the intended use case of Nextflow (which is oriented around channel communication/triggers... but... I just need to get this done.)</p>

CC BY-SA 4.0
2022-01-26T17:06:41.570Z
Could you please elaborate on how you tried to do dummy channels? Maybe by giving an example. I would suggest to use [watchPath](https://www.nextflow.io/docs/latest/channel.html#watchpath) but using this type wouldn't allow your pipeline to finish.
user324810
<nextflow><workflow-management>
How to execute several processes sequentially, without channels?
# How to execute several processes sequentially, without channels?

(Asked by: username_0 on 2021-05-21)

Using DSL2.

I have processes A, B, C which I want to run in sequence - B waits for A to finish, C waits for B to finish.

They are not communicating via channels so I can't do A.out.collect().

I have tried making dummy channels but this is problematic and a hack. The onComplete subscription doesn't seem to let me trigger another process.

What is the correct way to run a sequence of processes which are not communicating or triggered by channels?

P.S. I am aware that this is not really the intended use case of Nextflow (which is oriented around channel communication/triggers... but... I just need to get this done.)

**Tags:** nextflow, workflow-management
> **Comments:**
> **username_1**: Could you please elaborate on how you tried to do dummy channels? Maybe by giving an example. I would suggest to use [watchPath](https://www.nextflow.io/docs/latest/channel.html#watchpath) but using this type wouldn't allow your pipeline to finish.  

---

## 1 answers

### Answer by username_2 on 2022-01-26. Score: 1

I would guess it is not possible without channels unless you are using beforeScript and afterScript. I came up with this solution:
#!/usr/bin/env nextflow

nextflow.enable.dsl=2

workflow {
  // C(B(A("")))

  next = ""
  next = A(next)
  next = B(next)
  next = C(next)
}


process A{
  echo true
  input: val _
  output: val ""

  """
  echo $task.process
  """
}

process B{
  echo true
  input: val _
  output: val ""

  """
  echo $task.process
  """
}

process C{
  echo true
  input: val _
  output: val ""

  """
  echo $task.process
  """
}

By using workflows you can change the execution order. But it is still a hack and I would prefer something like a next: keyword to specify the next process.

And for those not interested in DSL2:
process A {
  echo true

  output:
  val "" into B
  

  """
  echo "$task.process"
  """
}

process B {
  echo true

  input:
  val _ from B

  output:
  val "" into C

  """
  echo "$task.process"
  """
}

process C {
  echo true

  input:
  val _ from C

  """
  echo "$task.process"
  """
}

Also, I am quite curious to see other solutions.


---

