Skip to content

Commit b763c71

Browse files
authored
Merge pull request #4833 from StackStorm/orquesta-task-retry
Add support for orquesta task retry
2 parents 9fd42c2 + 519e85c commit b763c71

File tree

11 files changed

+155
-5
lines changed

11 files changed

+155
-5
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Added
1616
parameters to be supplied to the action on every execution of the alias. #4786
1717
* Add ``get_entrypoint()`` method to ``ActionResourceManager`` attribute of st2client.
1818
#4791
19+
* Add support for orquesta task retry. (new feature)
1920

2021
Changed
2122
~~~~~~~
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: orquesta-task-retry-exhausted
3+
description: A workflow demonstrating what happens when task retries are exhausted.
4+
runner_type: orquesta
5+
entry_point: workflows/orquesta-task-retry-exhausted.yaml
6+
enabled: true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: orquesta-task-retry
3+
description: A workflow demonstrating how to use task retry.
4+
runner_type: orquesta
5+
entry_point: workflows/orquesta-task-retry.yaml
6+
enabled: true
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 1.0
2+
3+
description: >
4+
A sample workflow that illustrates what happens when the task retries are exhausted. In this
5+
example, the workflow will loop until the file /tmp/done exists. A parallel task will wait for
6+
some time before creating the file. When completed, /tmp/done will be deleted. In this case
7+
where the retry will be exhausted, the wait will exit before the temp file is created and the
8+
workflow will fail as a result.
9+
10+
vars:
11+
- file: /tmp/<% str(random(1000000, 9999999)) %>
12+
13+
tasks:
14+
init:
15+
action: core.local cmd="rm -rf <% ctx().file %>"
16+
next:
17+
- when: <% succeeded() %>
18+
do: check, create
19+
20+
check:
21+
action: core.local
22+
input:
23+
cmd: >
24+
echo 'Do something useful here.';
25+
if [ ! -e <% ctx().file %> ]; then exit 1; fi
26+
retry:
27+
when: <% failed() %>
28+
count: 2
29+
next:
30+
- when: <% succeeded() %>
31+
do: delete
32+
33+
create:
34+
action: core.local cmd="sleep 3; touch <% ctx().file %>"
35+
36+
delete:
37+
action: core.local cmd="rm -f <% ctx().file %>"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: 1.0
2+
3+
description: >
4+
A sample workflow that illustrates the use of task retry to rerun task on error. In this example,
5+
the workflow will loop until the file /tmp/done exists. A parallel task will wait for some time
6+
before creating the file. When completed, /tmp/done will be deleted.
7+
8+
vars:
9+
- file: /tmp/<% str(random(1000000, 9999999)) %>
10+
11+
tasks:
12+
init:
13+
action: core.local cmd="rm -rf <% ctx().file %>"
14+
next:
15+
- when: <% succeeded() %>
16+
do: check, create
17+
18+
check:
19+
action: core.local
20+
input:
21+
cmd: >
22+
echo 'Do something useful here.';
23+
if [ ! -e <% ctx().file %> ]; then exit 1; fi
24+
retry:
25+
count: 3
26+
delay: 1
27+
next:
28+
- when: <% succeeded() %>
29+
do: delete
30+
31+
create:
32+
action: core.local cmd="sleep 3; touch <% ctx().file %>"
33+
34+
delete:
35+
action: core.local cmd="rm -f <% ctx().file %>"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git+https://github.com/StackStorm/orquesta.git@c80b139d8bbd7d59ccdc0461564e6a754066adaa#egg=orquesta
1+
git+https://github.com/StackStorm/orquesta.git@9706dc1f13a44deadb6cefc8e92c83caad591127#egg=orquesta

contrib/runners/orquesta_runner/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# If you want to update depdencies for a single component, modify the
66
# in-requirements.txt for that component and then run 'make requirements' to
77
# update the component requirements.txt
8-
git+https://github.com/StackStorm/orquesta.git@c80b139d8bbd7d59ccdc0461564e6a754066adaa#egg=orquesta
8+
git+https://github.com/StackStorm/orquesta.git@9706dc1f13a44deadb6cefc8e92c83caad591127#egg=orquesta

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cryptography==2.8
1414
eventlet==0.25.1
1515
flex==6.14.0
1616
git+https://github.com/StackStorm/logshipper.git@stackstorm_patched#egg=logshipper
17-
git+https://github.com/StackStorm/orquesta.git@c80b139d8bbd7d59ccdc0461564e6a754066adaa#egg=orquesta
17+
git+https://github.com/StackStorm/orquesta.git@9706dc1f13a44deadb6cefc8e92c83caad591127#egg=orquesta
1818
git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient
1919
git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file
2020
gitpython==2.1.11

st2common/in-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jsonschema
99
kombu
1010
mongoengine
1111
networkx
12-
git+https://github.com/StackStorm/orquesta.git@c80b139d8bbd7d59ccdc0461564e6a754066adaa#egg=orquesta
12+
git+https://github.com/StackStorm/orquesta.git@9706dc1f13a44deadb6cefc8e92c83caad591127#egg=orquesta
1313
oslo.config
1414
paramiko
1515
pyyaml

st2common/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ apscheduler==3.6.3
1010
cryptography==2.8
1111
eventlet==0.25.1
1212
flex==6.14.0
13-
git+https://github.com/StackStorm/orquesta.git@c80b139d8bbd7d59ccdc0461564e6a754066adaa#egg=orquesta
13+
git+https://github.com/StackStorm/orquesta.git@9706dc1f13a44deadb6cefc8e92c83caad591127#egg=orquesta
1414
gitpython==2.1.11
1515
greenlet==0.4.15
1616
ipaddr

0 commit comments

Comments
 (0)