dstandish commented on code in PR #24743:
URL: https://github.com/apache/airflow/pull/24743#discussion_r913090358


##########
airflow/example_dags/example_datasets.py:
##########
@@ -0,0 +1,137 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Example DAG for demonstrating behavior of Datasets feature.
+
+Notes on usage:
+
+Turn on all the dags.
+
+DAG dag1 should run because it's on a schedule.
+
+After dag1 runs, dag3 should be triggered immediately because its only
+dataset dependency is managed by dag1.
+
+No other dags should be triggered.  Note that even though dag4 depends on
+the dataset in dag1, it will not be triggered until dag2 runs.
+
+Next, trigger dag2.  After dag2 finishes, dag4 should run.
+
+Dags 5 and 6 should not run because they depend on datasets that never get 
updated.
+
+"""
+from datetime import datetime
+
+from airflow.models import DAG, Dataset
+from airflow.operators.bash import BashOperator
+
+dag1_dataset = Dataset('s3://dag1/output_1.txt', extra={'hi': 'bye'})
+dag2_dataset = Dataset('s3://dag2/output_1.txt', extra={'hi': 'bye'})
+with DAG(
+    dag_id='dag1',
+    catchup=False,
+    start_date=datetime(2020, 1, 1),
+    schedule_interval='@daily',
+    tags=['upstream'],
+) as dag1:
+    BashOperator(
+        outlets=[dag1_dataset],
+        inlets=[
+            Dataset('s3://some-dataset/dataset1.txt'),
+            Dataset('s3://some-dataset/dataset2.txt'),
+        ],
+        task_id='upstream_task_1',
+        bash_command="sleep 5",
+    )
+
+with DAG(
+    dag_id='dag2',
+    catchup=False,
+    start_date=datetime(2020, 1, 1),
+    schedule_interval=None,
+    tags=['upstream'],
+) as dag2:
+    BashOperator(
+        outlets=[dag2_dataset],
+        inlets=[
+            Dataset('s3://abc/dataset2.txt'),
+        ],
+        task_id='upstream_task_1',
+        bash_command="sleep 5",
+    )
+
+with DAG(
+    dag_id='dag3',
+    catchup=False,
+    start_date=datetime(2020, 1, 1),
+    schedule_on=[dag1_dataset],
+    schedule_interval=None,

Review Comment:
   yeah this was needed before i updated the handling of these params in dag.py
   
   previously had to set it to None because if left as NOTSET it would be 
updated to `@daily`
   
   just forgot to update example dag.  will do.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to