-
Notifications
You must be signed in to change notification settings - Fork 638
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
Add cmd output type #4493
Add cmd output type #4493
Conversation
Signed-off-by: Paolo Di Tommaso <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
I kinda like the idea of overloading |
I wanted to keep simple, at least as POC |
Next steps:
|
Is this ready to test with rnaseq? Even if it only supports single-line bash commands, should be enough. |
it should |
It doesn't seem to work with tuples, gonna need that for something like: tuple val('gunzip'), cmd("gunzip --version") |
I will add it |
@pditommaso sounds tempting to me, too, on this same ground by Ben. |
I think this comment is interesting: #4386 (comment) If multi-line is allowed, then we might leverage the shebang to allow non-bash executions, including other shells, Groovy, popular scripting langs such as Python .. a bit like the current scoping for the Thoughts on this point? |
I would say, if the command fail, the task should fail. I.e. consistent with the behaviour as for the main |
not sure it's possible |
On this point, I think I suggested that the user should be able to ignore the failure by specifying
Due to the compact nature of process inputs and outputs, it would be unwieldy to specify a multi-line script here. Instead, it should already be possible to reference a script from the Regarding the shebang, we could add a output:
cmd("print('Hello!')", shell: 'python') |
modules/nextflow/src/main/groovy/nextflow/script/params/TupleInParam.groovy
Outdated
Show resolved
Hide resolved
I'm starting to lean back towards a separate |
I agree on the leaning back, based on the |
So the multi-line output does not fail, but the newlines are converted to spaces: $ echo nxf_out_cmd_1=$(bash --version) > .command.env
$ cat .command.env
nxf_out_cmd_1=GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. The command itself is easily fixed with some quotes: $ echo nxf_out_cmd_1="$(bash --version)" > .command.env
$ cat .command.env
nxf_out_cmd_1=GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. But that would break the The same limitation already exists for |
A single line is a too weak assumption. If you notice, nf-core uses a multi-lines YAML snippet! |
That is only because they are eagerly formatting it to YAML. Instead in my proof-of-concept PR I use tuples and separate |
@pditommaso any blocker for this to be merged? Conversation around the review seems pretty much settled |
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Ok, I've cleaned up and refactored a but this. The main change is |
Nice! I like |
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]> Signed-off-by: Niklas Schandry <[email protected]>
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]> Signed-off-by: Niklas Schandry <[email protected]>
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]> Signed-off-by: Niklas Schandry <[email protected]>
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]>
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]> Signed-off-by: Niklas Schandry <[email protected]>
This PR introduces the output `eval` type that allows the definition of a script expression that needs to be computed in the script context to evaluate the output value to be emitted. An example would be: ``` process someTask { output: eval 'bash --version' ''' some-command --here ''' } ``` Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]> Signed-off-by: Niklas Schandry <[email protected]>
Implements the support for
cmd
output type to collect task tool version and metadata as described here #4386 (comment)POC usage: