-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyaml_variables.yml
51 lines (46 loc) · 1.51 KB
/
yaml_variables.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
# This example workflow demonstrates how to define & refer to YAML variables in workflows.
#
# 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
workflow:
input:
# Before the value, prefix the variable name with &
- city_name: &city_name Seattle
# The variable name doesn't have to match the yaml name
- state: &default_state WA
# Variables can be multi-line using a pipe
# but not as part of the input block
source: &source |
import os
print(os.environ['CITY_NAME'], os.environ['STATE'])
tasks:
variable:
action: civis.scripts.python3
input:
params:
- name: 'CITY_NAME'
type: 'string'
# reference variables with *
default: *city_name
- name: 'STATE'
type: 'string'
default: *default_state
source: *source
variable_2:
action: civis.scripts.python3
input:
params:
- name: 'CITY_NAME'
type: 'string'
default: 'Washington'
- name: 'STATE'
type: 'string'
default: 'DC'
source: *source