Re: Taverna exit code
On 16 September 2016 at 13:56, Simone Bnà wrote: > Yes, I am interested in a option like the --fail-on-any-error that when an > activity tool fails the executeworkflow.sh fails too > and the exit code of the activity is propagated to the exitcode of the > executeworkflow. > > How can I set this option in taverna server 2.5? Using the admin panel? My apologies - I thought it as a potential improvement or new feature if you like.. Would you be interested in having a go? I think these would be the right places to add it: Add --fail-on-any-error option here: https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/CommandLineOptionsImpl.java Propagate to the Taverna Engine here somehow: https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java#L252 https://github.com/apache/incubator-taverna-engine#which-module-does-what explains the different engine parts This class has a listener of results being produced across the workflow and also access to the facade https://github.com/apache/incubator-taverna-engine/blob/master/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/LocalExecutionMonitor.java and so it could call cancelWorkflowRun() https://taverna.incubator.apache.org/javadoc/taverna-engine/org/apache/taverna/facade/WorkflowInstanceFacade.html#cancelWorkflowRun-- And in the end, this should return an error code rather than just print at stdout https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java#L306 -- Stian Soiland-Reyes http://orcid.org/-0001-9842-9718
Re: Taverna exit code
Hi Stian, Alan, reply is in line: > (No need to cc support@mygrid, we're all no dev@taverna :) Sorry :) > Perhaps valuable would be some kind of --fail-on-any-error option to > executeworkflow? This could then be enabled in the server. It could > bail out as soon as an error document appears at an output port. Yes, I am interested in a option like the --fail-on-any-error that when an activity tool fails the executeworkflow.sh fails too and the exit code of the activity is propagated to the exitcode of the executeworkflow. How can I set this option in taverna server 2.5? Using the admin panel? Best regards, Simone. - (No need to cc support@mygrid, we're all no dev@taverna :) The exit code from Taverna server reflects the exit code from executeworkflow.sh - which would be 0 unless the workflow engine itself failed. (e.g. the t2flow used a plugin that was not installed on the server, or a file was not found) The exit code of a individual tool within the workflow does not cause the workflow to fail, but rather it will propagate "Error Documents" on its outputs. Anything 'below' in the workflow expecting this value will then in turn produce derived Error Documents. This means that if the errror was within a list iteration, only that element of the list (and subsequent iterations) are replaced with errors. Similarly, the stdout and stderr of the individual tool (of which many could be running concurrently) is captured by the workflow engine and thus not shown in the stdout or stderr REST resources of the Server's executeworkflow execution. I just check the Tool Activity, and here it waits for the exit code: https://github.com/apache/incubator-taverna-common-activities/blob/master/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java#L384 You see it will provide the STDERR output as part of the exception (which then goes into the error document). It's configurable to allow certain exit codes, but this is not exposed in the UI. (Not so sure about that UnsupportedEncodingException handling there.. ) Perhaps valuable would be some kind of --fail-on-any-error option to executeworkflow? This could then be enabled in the server. It could bail out as soon as an error document appears at an output port. -- Simone Bnà, PhD C++ Software Developer, CINECA Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy office: +39-0516171938 email: s@scsitaly.com/s...@cineca.it
Re: taverna exit code
Bah - of course! You did think of everything :) BTW - would it be possible to have a kind of "Force-fail" option in the dispatch stack? The Error layer could be configured on a critical step, to trigger stopping the whole workflow (activating all the Stop layers) if it detects an error. Or would it need access to the WorkflowFacade for that? On 16 September 2016 at 10:17, alaninmcr wrote: > On 16/09/2016 09:44, Stian Soiland-Reyes wrote: > > [snip] > >> It's configurable to allow certain exit codes, but this is not exposed >> in the UI. > > > It _is_ in the UI. It's under the "Command" tab in the field "Valid return > codes". However, I think that Simone wants it to fail rather than be valid. > > [snip] > > Alan -- Stian Soiland-Reyes http://orcid.org/-0001-9842-9718
Re: taverna exit code
On 16/09/2016 09:44, Stian Soiland-Reyes wrote: [snip] It's configurable to allow certain exit codes, but this is not exposed in the UI. It _is_ in the UI. It's under the "Command" tab in the field "Valid return codes". However, I think that Simone wants it to fail rather than be valid. [snip] Alan
Re: taverna exit code
(No need to cc support@mygrid, we're all no dev@taverna :) The exit code from Taverna server reflects the exit code from executeworkflow.sh - which would be 0 unless the workflow engine itself failed. (e.g. the t2flow used a plugin that was not installed on the server, or a file was not found) The exit code of a individual tool within the workflow does not cause the workflow to fail, but rather it will propagate "Error Documents" on its outputs. Anything 'below' in the workflow expecting this value will then in turn produce derived Error Documents. This means that if the errror was within a list iteration, only that element of the list (and subsequent iterations) are replaced with errors. Similarly, the stdout and stderr of the individual tool (of which many could be running concurrently) is captured by the workflow engine and thus not shown in the stdout or stderr REST resources of the Server's executeworkflow execution. I just check the Tool Activity, and here it waits for the exit code: https://github.com/apache/incubator-taverna-common-activities/blob/master/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java#L384 You see it will provide the STDERR output as part of the exception (which then goes into the error document). It's configurable to allow certain exit codes, but this is not exposed in the UI. (Not so sure about that UnsupportedEncodingException handling there.. ) Perhaps valuable would be some kind of --fail-on-any-error option to executeworkflow? This could then be enabled in the server. It could bail out as soon as an error document appears at an output port. On 15 September 2016 at 15:53, Simone Bnà wrote: > Hi, > > I created a simple t2flow with an external tool that exits with a status code > different from 0, like below: > > #!/bin/bash > set -e > function mytest { > "$@" > local status=$? > if [ $status -ne 0 ]; then > echo "error with $1" >&2 > exit $status > fi > } > mytest ssh `echo ${REMOTE_USER}@${COMPUTE_HOST}` " cd > /folder_that_does_not_exist/;" > echo 'finished' > exit 0 > > My code polls the taverna server (version 2.5.4) until the run finishes and > then check the exitcode (GET > https://host:port/taverna-server/rest/runs/UUID/listeners/io/properties/exitcode) > > What I found is that the exitcode of taverna is 0, different from the exit > code of the bash script. > > Is this a bug? Is there another way to get the right exit code? > > Best regards, > > Simone. > > > > -- > Simone Bnà, PhD > C++ Software Developer, CINECA > Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy > office: +39-0516171938 > email: s@scsitaly.com/s...@cineca.it -- Stian Soiland-Reyes http://orcid.org/-0001-9842-9718