forked from nextflow-io/nextflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eval output type (nextflow-io#4493)
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 <paolo.ditommaso@gmail.com> Signed-off-by: Ben Sherman <bentshermann@gmail.com> Co-authored-by: Ben Sherman <bentshermann@gmail.com> Co-authored-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com> Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
- Loading branch information
Showing
27 changed files
with
780 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
process myTask { | ||
output: | ||
env FOO | ||
|
||
script: | ||
''' | ||
FOO=$(ls -a) | ||
''' | ||
} | ||
|
||
workflow { | ||
myTask | view | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
. | ||
.. | ||
.command.begin | ||
.command.err | ||
.command.log | ||
.command.out | ||
.command.run | ||
.command.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
process sayHello { | ||
output: | ||
eval('bash --version') | ||
|
||
""" | ||
echo Hello world! | ||
""" | ||
} | ||
|
||
workflow { | ||
sayHello | view | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
process sayHello { | ||
output: | ||
stdout | ||
|
||
""" | ||
echo Hello world! | ||
""" | ||
} | ||
|
||
workflow { | ||
sayHello | view { "I say... $it" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
I say... Hello world! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
modules/nextflow/src/main/groovy/nextflow/exception/ProcessEvalException.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2013-2023, Seqera Labs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package nextflow.exception | ||
|
||
import groovy.transform.CompileStatic | ||
|
||
/** | ||
* Exception thrown when a command output returns a non-zero exit status | ||
* | ||
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com> | ||
*/ | ||
@CompileStatic | ||
class ProcessEvalException extends RuntimeException implements ShowOnlyExceptionMessage { | ||
|
||
String command | ||
String output | ||
int status | ||
|
||
ProcessEvalException(String message, String command, String output, int status) { | ||
super(message) | ||
this.command = command | ||
this.output = output | ||
this.status = status | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.