Skip to content

Conversation

@bentsherman
Copy link
Member

This PR adds the ability to declare a param as a collection type:

params {
  input: List<Map>
}

workflow {
  println params.input*.id.join(',')
}

And supply a CSV, JSON, or YAML file at runtime:

$ cat input.json
[
  { "id": "1", "fastq": "data/1.fastq" },
  { "id": "2", "fastq": "data/2.fastq" },
  { "id": "3", "fastq": "data/3.fastq" }
]

$ nextflow run main.nf --input input.json
1,2,3

Nextflow interprets the string as a file path and attempts to load the file contents based on the file extension. A runtime error is reported if the file contents are not compatible with the declared type.

Future work will extend the type validation with record types.

(spun off from #6574)

@bentsherman bentsherman requested a review from jorgee December 18, 2025 19:38
@bentsherman bentsherman requested a review from a team as a code owner December 18, 2025 19:38
@netlify
Copy link

netlify bot commented Dec 18, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 232387b
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/694581c8f6f300000849bbc8

Copy link
Collaborator

@christopher-hakkaart christopher-hakkaart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good. No comments.

Copy link
Contributor

@jorgee jorgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been testing with other standard library objects, and it is working with Set and List, but not with Bag, IterableandMap`.

  • It is not possible to cast the ArrayList object returned by the slurpers to a Bag. I think it should be supported as in the documentation clearly says that Bag is a Collection.
  • Iterable is a superinterface of Collection
  • Map is not a Collection, but there is a direct mapping of YAML and JSON files with Maps.

Not sure if it was the goal of the PR to support all the types, but I see it is possible with very little changes. I have created #6676 to support all these types.

@bentsherman
Copy link
Member Author

Thanks Jorge. I intentionally did not support Iterable and Map because I'm not sure about those cases yet. But I did intend to support Bag so thank you for catching that

@jorgee
Copy link
Contributor

jorgee commented Dec 19, 2025

@pditommaso the bump of Netty version is producing failures in azure tests

java.lang.IllegalArgumentException: The URI contain illegal characters: /my-data?restype=container&comp=list&prefix=work/4a/332d3d24a0334ab4b84d8992095d35&marker=2%21120%21MDAwMDQ0IXdvcmsvNGEvMzMyZDNkMjRhMDMzNGFiNGI4NGQ4OTkyMDk1ZDM1L2YxLmZhITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaIQ--&maxresults=10
	at io.netty.handler.codec.http.HttpUtil.validateRequestLineTokens(HttpUtil.java:90)
	at io.netty.handler.codec.http.DefaultHttpRequest.<init>(DefaultHttpRequest.java:95)
	at io.netty.handler.codec.http.DefaultFullHttpRequest.<init>(DefaultFullHttpRequest.java:103)
	at io.netty.handler.codec.http.DefaultFullHttpRequest.<init>(DefaultFullHttpRequest.java:95)
	at io.netty.handler.codec.http.DefaultFullHttpRequest.<init>(DefaultFullHttpRequest.java:87)
	at io.netty.handler.codec.http.DefaultFullHttpRequest.<init>(DefaultFullHttpRequest.java:50)
	at reactor.netty.http.client.HttpClientOperations.newFullBodyMessage(HttpClientOperations.java:884)
	at reactor.netty.http.client.HttpClientOperations.lambda$send$2(HttpClientOperations.java:913)
	at reactor.netty.FutureMono$DeferredFutureMono.subscribe(FutureMono.java:100)
	at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53)
	at reactor.netty.http.client.HttpClientConnect$HttpIOHandlerObserver.onStateChange(HttpClientConnect.java:459)
	at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:722)
	at reactor.netty.resources.DefaultPooledConnectionProvider$DisposableAcquire.run(DefaultPooledConnectionProvider.java:294)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:405)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1447)
Dec-19 14:18:51.285 [TaskFinalizer-1] ERROR c.a.c.h.netty.NettyAsyncHttpClient - The URI contain illegal characters: /my-data?restype=container&comp=list&prefix=work/4a/332d3d24a0334ab4b84d8992095d35&marker=2%21120%21MDAwMDQ0IXdvcmsvNGEvMzMyZDNkMjRhMDMzNGFiNGI4NGQ4OTkyMDk1ZDM1L2YxLmZhITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaIQ--&maxresults=10
Dec-19 14:18:51.285 [TaskFinalizer-1] ERROR c.a.s.c.policy.RequestRetryPolicy - The URI contain illegal characters: /my-data?restype=container&comp=list&prefix=work/4a/332d3d24a0334ab4b84d8992095d35&marker=2%21120%21MDAwMDQ0IXdvcmsvNGEvMzMyZDNkMjRhMDMzNGFiNGI4NGQ4OTkyMDk1ZDM1L2YxLmZhITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaIQ--&maxresults=10
Dec-19 14:18:51.285 [TaskFinalizer-1] ERROR c.a.s.c.i.StorageImplUtils - null
Dec-19 14:18:51.442 [TaskFinalizer-1] DEBUG nextflow.processor.TaskProcessor - Handling unexpected condition for
  task: name=foo; work-dir=az://my-data/work/4a/332d3d24a0334ab4b84d8992095d35
  error [java.lang.RuntimeException]: java.lang.RuntimeException
Dec-19 14:18:51.450 [TaskFinalizer-1] ERROR nextflow.processor.TaskProcessor - Error executing process > 'foo'

Caused by:
  java.lang.RuntimeException


java.lang.RuntimeException: null
	at com.azure.storage.common.implementation.StorageImplUtils.sendRequest(StorageImplUtils.java:511)
	at com.azure.storage.blob.BlobContainerClient.lambda$listBlobs$7(BlobContainerClient.java:1050)
	at com.azure.core.http.rest.PagedIterable.lambda$new$5(PagedIterable.java:194)
	at com.azure.core.util.paging.ContinuablePagedByIteratorBase.requestPage(ContinuablePagedByIteratorBase.java:104)
	at com.azure.core.util.paging.ContinuablePagedByIteratorBase.hasNext(ContinuablePagedByIteratorBase.java:65)
	at nextflow.cloud.azure.nio.AzFileSystem$_guessPath_lambda10.doCall(AzFileSystem.groovy:395)
	at dev.failsafe.Functions.lambda$toCtxSupplier$11(Functions.java:236)
	at dev.failsafe.Functions.lambda$get$0(Functions.java:46)
	at dev.failsafe.internal.RetryPolicyExecutor.lambda$apply$0(RetryPolicyExecutor.java:75)
	at dev.failsafe.SyncExecutionImpl.executeSync(SyncExecutionImpl.java:176)
	at dev.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:437)
	at dev.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:115)
	at nextflow.cloud.azure.nio.AzFileSystem.apply(AzFileSystem.groovy:564)

@bentsherman bentsherman force-pushed the collection-param-from-file branch from 2fc2409 to 232387b Compare December 19, 2025 16:48
@bentsherman bentsherman merged commit 8067145 into master Dec 19, 2025
26 checks passed
@bentsherman bentsherman deleted the collection-param-from-file branch December 19, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants