-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nullable input/output paths #4293
Conversation
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
@bentsherman this is an interesting change. And with this PR, instead of a list of max length 1, it would be just a |
Yes. With |
When I use the new edge (not this PR), it says
When using
When I run with an index, I get an index back (wrapped in a list)
When I run with no index, I get an empty list in place of the index, which can be used as an input downstream.
Ideally and in my opinion, logically, I would think It just seems that making |
Sorry, I got some things mixed up. Arity On the other hand, an empty array would make things simple. The problem with the null file approach (implemented in this PR) is that Nextflow is trying to use it like a real file throughout the code, so we either have to re-route null files or add more no-op behavior to the You might be able to do |
Thanks for the insight. You mention that the intent is to have a path that may or may not be I do believe, regardless of how it is implemented, the ability to use |
It would. I just wonder if it could cause confusion with any dataflow logic between the two processes, where For example, |
This is unlikely to be resolved before static types are implemented. I will try to fold nullable paths into #4553 , should be easier there anyway |
Note to self on mapping static types to arity:
So I think the arity option won't be relevant with static types + records because any arity can be represented with a particular type. |
Close #2678
This PR contains the support for nullable paths via
arity: '0..1'
, which was implemented in PR #3706 but ultimately excluded because it is tricky to implement.With the new arity feature, you can set
arity: '0..*'
to specify that a path input/output should be a list and can be empty.With this PR, you can also set
arity: '0..1'
to specify that a path input/output should be a single file but could also be null. Whereasoptional: true
emits nothing if no file is produced, this "nullable" path emits a null value which can be accepted by similarly nullable inputs.The problem with the current implementation is that the null path is being passed through some code that it shouldn't, and produces this warning:
While it still works, ideally the null path should bypass any code that would try to use it like a real file.
Additionally, it should be considered whether nullable paths should be implemented with a separate option like
nullable: true
instead of adding it on to the arity feature, which might simplify the logic a bit.