Skip to content

Instantly share code, notes, and snippets.

@agalea91
Last active September 17, 2020 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agalea91/9906d4f75c685a6119e23230ae00fe5f to your computer and use it in GitHub Desktop.
Save agalea91/9906d4f75c685a6119e23230ae00fe5f to your computer and use it in GitHub Desktop.
For medium blog post: Airflow Dynamic DAGs - Python Globals
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