Skip to content

Instantly share code, notes, and snippets.

@gagejustins
Last active February 10, 2019 15:21
Show Gist options
  • Save gagejustins/3b68c7eb66be493fe6952d3bfe0d8ae3 to your computer and use it in GitHub Desktop.
Save gagejustins/3b68c7eb66be493fe6952d3bfe0d8ae3 to your computer and use it in GitHub Desktop.
from airflow import DAG
from airflow.operators import PythonOperator
from datetime import datetime
dag = DAG(
dag_id = 'my_first_dag',
start_date = datetime(2019,1,15),
schedule_interval = '0 2 * * *')
def print_hello():
return "hello!"
def print_goodbye():
return "goodbye!"
print_hello = PythonOperator(
task_id = 'print_hello',
#python_callable param points to the function you want to run
python_callable = print_hello,
#dag param points to the DAG that this task is a part of
dag = dag)
print_goodbye = PythonOperator(
task_id = 'print_goodbye',
python_callable = print_goodbye,
dag = dag)
#Assign the order of the tasks in our DAG
print_hello >> print_goodbye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment