You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using orquesta workflows if a task fails but still publishes content the workflow is marked as succeeded. This happens if there is no when clause and when there is a when failed clause.
STACKSTORM VERSION
# st2 --version
st2 3.1.0, on Python 2.7.5
OS, environment, install method
# cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"
ID="rhel"
Install method is Puppet forge module
Steps to reproduce the problem
Using the examples.orquesta-basic workflow. We can need to modify the workflow to remove the when: <% succeeded() %> or modify it to be when: <% succeeded() or failed() %>
---
name: orquesta-basic
pack: examples
description: Run a local linux command
runner_type: orquesta
entry_point: workflows/orquesta-basic.yaml
enabled: true
parameters:
cmd:
required: true
type: string
timeout:
type: integer
default: 60
can be forced to fail by running invalid command:
st2 run examples.orquesta-basic cmd="secho 'hi'"
Expected Results
I would expect the results of the workflow to be failed when the task fails unless manually overridden.
Actual Results
The workflow says succeeded even though the single task failed. Looking at the logs it looks like a second subtask is formed for the publish method that succeeds and send that to the workflow.
@nmaludy This behavior is expected. When a task failed and there is a task transition (an entry under next), then the task is considered remediated. When a task is remediated, the workflow will continue. If you want the workflow to fail, you have to explicitly tell the workflow to fail with the engine command.
I also think (if I remember correctly) this only happens when we do a publish, if there is no publish then it fails as expected
That's true. The rule here is that if there's an entry under next with any combination of the fields, then it's considered remediated. So even if there's just a publish, it's considered remediated.
It will also cause us to duplicate our next blocks, one for success, one for failure just like Mistral
Yes, you will have to explicitly do that. We are also working on a proposal at StackStorm/orquesta#116. I believe this will help where you can publish some vars regardless of task completion status and then nest other whens to say do this and that.
then copy that over/over
You have to provide a more concrete use case. You can conceptually do this..
@nmaludy Per conversation on https://stackstorm-community.slack.com/team/U4H00PLGP, we'll have to explore this a bit more. Regarding your proposal for this use case, when you have a task that fails and no transitions are executed, that the workflow itself should fail. By no transitions are executed, 1) no task transition matched condition or 2) when condition of one or more task transitions are met but there are no tasks to execute next.
From initial assessment, changes need to happen in the state machine where the task is evaluated if remediation has occurred at https://github.com/StackStorm/orquesta/blob/master/orquesta/machines.py#L657. In this case, 1) if no task transition matched condition or 2) when condition of one or more task transitions are met but there are no tasks to execute next, then the task is not considered remediated.
Activity
nmaludy commentedon Jul 12, 2019
@m4dcoder this is causing us issues because we're expecting the workflow to fail since the task failed.
However, when we publish a variable to return data to the calling workflow, this automatically marks the workflow as succeeding.
namachieli commentedon Jul 16, 2019
I'm seeing similar, but opposite. I have a workflow that should Succeed, but fails when using
publish:anddo: noopwith nowhen:Tasks fail, and cause the workflow to fail, even though every task has
do: noopm4dcoder commentedon Jul 16, 2019
@namachieli Please open a separate issue.
m4dcoder commentedon Jul 16, 2019
@nmaludy This behavior is expected. When a task failed and there is a task transition (an entry under
next), then the task is considered remediated. When a task is remediated, the workflow will continue. If you want theworkflowto fail, you have to explicitly tell the workflow tofailwith the engine command.nmaludy commentedon Jul 16, 2019
@m4dcoder well that's confusing and inconsistent with the way Mistral work (that's fine).. would be nice if this was called out somewhere
It will also cause us to duplicate our
nextblocks, one for success, one for failure just like Mistralnmaludy commentedon Jul 16, 2019
I also think (if I remember correctly) this only happens when we do a publish, if there is no publish then it fails as expected
m4dcoder commentedon Jul 16, 2019
I really don't care about how Mistral works at this point.
m4dcoder commentedon Jul 16, 2019
We can update our documentation so this is clearer.
nmaludy commentedon Jul 16, 2019
so, basically in any task that contains any transition at all we also need another transition that is:
then copy that over/over?
m4dcoder commentedon Jul 16, 2019
That's true. The rule here is that if there's an entry under
nextwith any combination of the fields, then it's considered remediated. So even if there's just apublish, it's considered remediated.Yes, you will have to explicitly do that. We are also working on a proposal at StackStorm/orquesta#116. I believe this will help where you can publish some vars regardless of task completion status and then nest other whens to say do this and that.
You have to provide a more concrete use case. You can conceptually do this..
m4dcoder commentedon Jul 16, 2019
@nmaludy Per conversation on https://stackstorm-community.slack.com/team/U4H00PLGP, we'll have to explore this a bit more. Regarding your proposal for this use case, when you have a task that fails and no transitions are executed, that the workflow itself should fail. By
no transitions are executed, 1) no task transition matched condition or 2) when condition of one or more task transitions are met but there are no tasks to execute next.m4dcoder commentedon Jul 17, 2019
From initial assessment, changes need to happen in the state machine where the task is evaluated if remediation has occurred at https://github.com/StackStorm/orquesta/blob/master/orquesta/machines.py#L657. In this case, 1) if no task transition matched condition or 2) when condition of one or more task transitions are met but there are no tasks to execute next, then the task is not considered remediated.