Created
April 19, 2016 11:13
-
-
Save yuyou/baa73df674d1dbcbc14d35b1fc293415 to your computer and use it in GitHub Desktop.
A test Airflow dag to show the monthly "schedule_interval".
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.operators import BashOperator | |
from airflow.models import DAG | |
from datetime import datetime, timedelta | |
args = { | |
'start_date': datetime.utcnow(), | |
'owner': 'airflow', | |
} | |
one_month_ago = datetime.combine(datetime.today() - timedelta(30), | |
datetime.min.time()) | |
dag = DAG( | |
dag_id='hello', | |
default_args=args, | |
schedule_interval="@monthly") | |
#schedule_interval=None) | |
bash_task = BashOperator( | |
task_id="bash_task", | |
bash_command='echo "hello world"', | |
dag=dag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this dag, you could use "backfill" to test it, for example, 4 runs from 2016-01-01 to 2016-04-01.
airflow backfill hello -s 2016-01-01 -e 2016-04-01