From 8897d1a6d2b7f993e0dff13c9960daabb290f550 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 7 Sep 2021 22:03:36 +0800 Subject: [PATCH] Fix imports in example DAG --- airflow/example_dags/example_workday_timetable.py | 5 +---- docs/apache-airflow/howto/timetable.rst | 12 +++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/airflow/example_dags/example_workday_timetable.py b/airflow/example_dags/example_workday_timetable.py index be9c7f9fb3f4c..c1165e6e08d4a 100644 --- a/airflow/example_dags/example_workday_timetable.py +++ b/airflow/example_dags/example_workday_timetable.py @@ -18,16 +18,13 @@ """Example DAG demostrating how to implement a custom timetable for a DAG.""" -from plugins.workday import AfterWorkdayTimetable - # [START howto_timetable] from airflow import DAG +from airflow.example_dags.plugins.workday import AfterWorkdayTimetable from airflow.operators.dummy import DummyOperator -# [START howto_timetable_example_dag] with DAG(timetable=AfterWorkdayTimetable(), tags=["example", "timetable"]) as dag: DummyOperator(task_id="run_this") -# [END howto_timetable_example_dag] if __name__ == "__main__": dag.cli() diff --git a/docs/apache-airflow/howto/timetable.rst b/docs/apache-airflow/howto/timetable.rst index 2d01ba13dc74a..a76f9445fe9d1 100644 --- a/docs/apache-airflow/howto/timetable.rst +++ b/docs/apache-airflow/howto/timetable.rst @@ -88,11 +88,13 @@ Next, we'll start putting code into ``AfterWorkdayTimetable``. After the implementation is finished, we should be able to use the timetable in our DAG file: -.. exampleinclude:: /../../airflow/example_dags/example_workday_timetable.py - :language: python - :dedent: 4 - :start-after: [START howto_timetable_example_dag] - :end-before: [END howto_timetable_example_dag] +.. code-block:: python + + from airflow import DAG + + + with DAG(timetable=AfterWorkdayTimetable(), tags=["example", "timetable"]) as dag: + ... Define Scheduling Logic