Skip to content

Instantly share code, notes, and snippets.

@iht
Last active June 22, 2020 19:11
Show Gist options
  • Save iht/2c9c2c7135cb3fc6d7ccef2fd8fb1bde to your computer and use it in GitHub Desktop.
Save iht/2c9c2c7135cb3fc6d7ccef2fd8fb1bde to your computer and use it in GitHub Desktop.
A simple DAG that will be "sensed" using a ExternalTaskSensor in Airflow
"""Simple dag #1."""
from airflow import models
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators import python_operator
from airflow.utils.dates import days_ago
with models.DAG(
'dag_1',
schedule_interval='*/1 * * * *', # Every 1 minute
start_date=days_ago(0),
catchup=False) as dag:
def greeting():
"""Just check that the DAG is started in the log."""
import logging
logging.info('Hello World from DAG 1')
hello_python = python_operator.PythonOperator(
task_id='hello',
python_callable=greeting)
goodbye_dummy = DummyOperator(task_id='goodbye')
hello_python >> goodbye_dummy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment