Lee-W commented on code in PR #41037: URL: https://github.com/apache/airflow/pull/41037#discussion_r1694044354
########## airflow/example_dags/example_dataset_alias.py: ########## @@ -0,0 +1,104 @@ +# 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 the behavior of the DatasetAlias feature in Airflow, including conditional and +dataset expression-based scheduling. + +Notes on usage: + +Turn on all the DAGs. + +Before running any DAG, the schedule of the "dataset-alias-consumer" DAG will show as "unresolved DatasetAlias". +This is expected because the dataset alias has not been resolved into any dataset yet. + +Once the "dataset-alias-producer" DAG is triggered, the "dataset-consumer" DAG should be triggered upon completion. +This is because the dataset alias "example-alias" is used to add a dataset event to the dataset "s3://bucket/my-task" +during the "produce_dataset_events_through_dataset_alias" task. +After the completion of this task, the schedule of the "dataset-alias-consumer" DAG should change to "Dataset" as +the dataset alias "example-alias" is now resolved to the dataset "s3://bucket/my-task". +It's expected that the "dataset-alias-consumer" DAG is not triggered at this point, despite also relying on +the dataset alias "example-alias," which was initially resolved to nothing. +Once the resolution occurs, triggering either the "dataset-producer" or "dataset-alias-producer" DAG should +also trigger both the "dataset-consumer" and "dataset-alias-consumer" DAGs. +""" + +from __future__ import annotations + +import pendulum + +from airflow import DAG +from airflow.datasets import Dataset, DatasetAlias +from airflow.decorators import task + +with DAG( + dag_id="dataset-producer", Review Comment: I think naming it differently might be better. I'll fix it. Thanks for your suggestion! -- 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]
