Last active
September 17, 2020 02:54
-
-
Save agalea91/9906d4f75c685a6119e23230ae00fe5f to your computer and use it in GitHub Desktop.
For medium blog post: Airflow Dynamic DAGs - Python Globals
This file contains 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 airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
from crypto_prices import get_price, send_email | |
with DAG( | |
"email_bitcoin_price", | |
default_args={"start_date": "2020-01-01"}, | |
schedule_interval="0 0 * * *", | |
) as dag: | |
get_price_task = PythonOperator( | |
task_id="get_price", | |
python_callable=get_price, | |
op_kwargs=dict( | |
symbol="BTC", | |
), | |
) | |
email_price_task = PythonOperator( | |
task_id="email_price", | |
python_callable=email_price, | |
) | |
( | |
get_price_task | |
>> email_price_task | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment