Skip to content

Instantly share code, notes, and snippets.

@aaronpolhamus
Created September 28, 2017 18:31
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 aaronpolhamus/4616738f353093d8bdd84b057e0fa1fe to your computer and use it in GitHub Desktop.
Save aaronpolhamus/4616738f353093d8bdd84b057e0fa1fe to your computer and use it in GitHub Desktop.
from datetime import datetime
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator
DAG = DAG(
dag_id='scheduler_test_dag',
start_date=datetime(2017, 9, 9, 4, 0, 0, 0), #..EC2 time. Equal to 11pm hora México
max_active_runs=1,
schedule_interval='*/1 * * * *' #..ever minute
)
def ticker_function():
with open('/tmp/ticker', 'a') as outfile:
outfile.write('{}\n'.format(datetime.now()))
time_ticker = PythonOperator(
task_id='time_ticker',
python_callable=ticker_function,
dag=DAG
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment