Skip to content

Commit

Permalink
[AIRFLOW-575] Clarify tutorial and FAQ about schedule_interval alwa…
Browse files Browse the repository at this point in the history
…ys inheriting from DAG object

- Update the tutorial with a comment helping to explain the use of default_args and
include all the possible parameters in line
- Clarify in the FAQ the possibility of an unexpected default `schedule_interval`in case
airflow users mistakenly try to overwrite the default `schedule_interval` in a DAG's
`default_args` parameter
  • Loading branch information
lauralorenz committed Oct 17, 2016
1 parent 11ad53a commit 80d3c8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions airflow/example_dags/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
seven_days_ago = datetime.combine(datetime.today() - timedelta(7),
datetime.min.time())

# these args will get passed on to each operator
# you can override them on a per-task basis during operator initialization
default_args = {
'owner': 'airflow',
'depends_on_past': False,
Expand All @@ -22,11 +24,19 @@
# 'queue': 'bash_queue',
# 'pool': 'backfill',
# 'priority_weight': 10,
# 'schedule_interval': timedelta(1),
# 'end_date': datetime(2016, 1, 1),
# 'wait_for_downstream': False,
# 'dag': dag,
# 'adhoc':False,
# 'sla': timedelta(hours=2),
# 'execution_timeout': timedelta(seconds=300),
# 'on_failure_callback': some_function,
# 'on_success_callback': some_other_function,
# 'on_retry_callback': another_function,
# 'trigger_rule': u'all_success'
}

dag = DAG('tutorial', default_args=default_args)
dag = DAG('tutorial', default_args=default_args, schedule_interval=timedelta(days=1))

# t1, t2 and t3 are examples of tasks created by instantiating operators
t1 = BashOperator(
Expand Down
5 changes: 5 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Here are some of the common causes:
- Is your ``start_date`` set properly? The Airflow scheduler triggers the
task soon after the ``start_date + scheduler_interval`` is passed.

- Is your ``schedule_interval`` set properly? The default ``schedule_interval``
is one day (``datetime.timedelta(1)``). You must specify a different ``schedule_interval``
directly to the DAG object you instantiate, not as a ``default_param``, as task instances
do not override their parent DAG's ``schedule_interval``.

- Is your ``start_date`` beyond where you can see it in the UI? If you
set your it to some time say 3 months ago, you won't be able to see
it in the main view in the UI, but you should be able to see it in the
Expand Down

0 comments on commit 80d3c8d

Please sign in to comment.