Can't convert Channel to List to use Groovy methods in DSL2 #2547
-
Bug reportSimilar to #2274 but I haven't found a satisfying solution. Using DSL2, it seems Channels can no longer be converted to Lists. DSL1 ✅ list = Channel.of(1, 2, 3).toList().get()
println(list.toString()) // outputs [1, 2, 3] DSL2 ❌ nextflow.enable.dsl = 2
list = Channel.of(1, 2, 3).toList().get() // freezes
println(list.toString()) DSL1 ✅ list = []
Channel.of(1, 2, 3).toList().subscribe(onNext: { it -> list = it })
println(list.toString()) // outputs [1, 2, 3] DSL2 ❌ nextflow.enable.dsl = 2
list = []
Channel.of(1, 2, 3).toList().subscribe(onNext: { it -> list = it })
println(list.toString()) // outputs [] Nextflow version: 21.04.3 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
The use of |
Beta Was this translation helpful? Give feedback.
-
Quick question as I am struggling for an onComplete function which I used for DSL1 and does not work anymore work DSL2.
|
Beta Was this translation helpful? Give feedback.
-
Thanks, completely understand and agree as well. As it is though for the
unstaging in the onComplete function, groovy has there it's justification
in my eyes.
Would never use it though indeed for anything within processes or to shape
channels. This should indeed be discouraged 😉
…On Sun, Nov 20, 2022, 6:51 PM Marcel Ribeiro Dantas < ***@***.***> wrote:
Most of the time, the issues I see are when people try to write "pure
Groovy" code to operate with things that exist only in the Nextflow DSL.
Processes and operators are not regular functions. Channels are not regular
lists/collections. If you take this into consideration, and try to stick to
the Nextflow DSL to interact with things brought up by the Nextflow DSL,
you should be fine.
As a good source for migration, I suggest checking out this link
<https://www.nextflow.io/docs/latest/dsl2.html>.
—
Reply to this email directly, view it on GitHub
<#2547 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWADDEEGSPBCHIHHNS7G3WJJQJNANCNFSM5LQ5FDOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
The use of
.get
does not make part of Nextflow DSL and it's not expected to work with DSL2. The last example is correct due to the asynchronous nature of the nextflow channels.