-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbranching_and_dependencies.yml
79 lines (69 loc) · 2.54 KB
/
branching_and_dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# This example workflow demonstrates how to use the "direct" workflow type
# in Mistral to build up a chain of jobs with dependencies. If you run this
# workflow, you should see an initial python job, and then three running in
# parallel, and then a final python job after those three are done.
#
# Workflows in the Civis Platform are written in YAML and a workflow DSL
# (domain specific language) called Mistral.
#
# See this website, https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html,
# for an introduction to YAML.
#
# See the Mistral documentation, https://docs.openstack.org/mistral/train/user/wf_lang_v2.html,
# for a description of the Mistral DSL.
version: '2.0' # you always need this key to specify version 2 of the mistral DSL
branching_and_dependencies: # the name of the workflow can be anything, but Platform ignores it
tasks: # all tasks for the workflow go here
python_init:
action: civis.scripts.python3
input:
name: python init
source: print("Hello from Python! We are just getting started!")
# This key indicates which tasks to run after this task succeeds.
# There are many possible options. See the mistral docs for details.
# Here we are listing all tasks to run in a list.
on-success:
- python_task_a
- python_task_b
- python_task_c
python_task_a:
action: civis.scripts.python3
input:
name: python task a
# some fancy YAML for multiline strings
source: |
import time
print("Python Task A greets you!", flush=True)
time.sleep(30)
# After this task finishes, it launches the final task.
on-success:
- python_final
python_task_b:
action: civis.scripts.python3
input:
name: python task b
source: |
import time
print("Python Task B greets you!", flush=True)
time.sleep(30)
on-success:
- python_final
python_task_c:
action: civis.scripts.python3
input:
name: python task c
source: |
import time
print("Python Task C greets you!", flush=True)
time.sleep(30)
on-success:
- python_final
python_final:
action: civis.scripts.python3
input:
name: python final
source: print("The final Python script greets you!")
# The join key tells Mistral that this task should wait for all tasks
# pointing to it (via the on-success keys above) before starting this
# task.
join: all