Last active
April 25, 2023 10:51
-
-
Save antweiss/07eb87d3d86cb448d319af22f22dde3d to your computer and use it in GitHub Desktop.
Aitflow bash operator with templating
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textwrap import dedent | |
# ... | |
templated_command = dedent( | |
""" | |
{% for i in range(5) %} | |
echo "{{ ds }}" #a variable (datestamp) | |
echo "{{ macros.ds_add(ds, 7)}}" #a built-in macro | |
{% endfor %} | |
""" | |
) | |
t3 = BashOperator( | |
task_id="templated", | |
depends_on_past=False, | |
bash_command=templated_command, | |
) | |
t2 >> t3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment