-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.py
40 lines (29 loc) · 846 Bytes
/
demo.py
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
"""
A simple workflow for demo, fork from https://airflow.apache.org/docs/apache-airflow/stable/tutorial.html
"""
from textwrap import dedent
from airfly.model import AirFly
class print_date(AirFly):
op_class = "BashOperator"
op_params = dict(bash_command="date")
templated_command = dedent(
"""
{% for i in range(5) %}
echo "{{ ds }}"
echo "{{ macros.ds_add(ds, 7)}}"
echo "{{ params.my_param }}"
{% endfor %}
"""
)
class templated(AirFly):
op_class = "BashOperator"
op_params = dict(
depends_on_past=False,
bash_command=templated_command,
params={"my_param": "Parameter I passed in"},
)
class sleep(AirFly):
op_class = "BashOperator"
op_params = dict(depends_on_past=False, bash_command="sleep 5", retries=3)
upstream = print_date
downstream = (templated,)