You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/14 04:16:12 UTC

[GitHub] [airflow] shubham22 commented on a diff in pull request #28333: Allow a DAG to be scheduled when any related DataSet is updated

shubham22 commented on code in PR #28333:
URL: https://github.com/apache/airflow/pull/28333#discussion_r1047998173


##########
airflow/migrations/versions/0123_2_6_0_add_dataset_schedule_mode_to_dag_model.py:
##########
@@ -0,0 +1,45 @@
+#
+# 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.
+
+"""add dataset schedule mode to DAG model
+
+Revision ID: 7afd6d4021a9
+Revises: 290244fb8b83
+Create Date: 2022-12-13 11:34:26.648465
+
+"""
+
+from __future__ import annotations
+
+import sqlalchemy as sa
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision = "7afd6d4021a9"
+down_revision = "290244fb8b83"
+branch_labels = None
+depends_on = None
+airflow_version = "2.6.0"
+
+
+def upgrade():
+    op.add_column("dag", sa.Column("run_on_any_dataset_changed", sa.Boolean(), nullable=False, default=False))

Review Comment:
   I agree with @allebacco's suggestion. Yes, you should aim for simplest implementation that can be changed easily in the future when there is clarity on the full scope. However, your design should be extensible enough that it doesn't break customer's workflows/setup. Adding a boolean column may be too limiting. Instead, using `dataset_scheduling_mode` as a string would be a better option because it can be easily extended. For the "quorum" case, you could use a new `dataset_scheduling_mode` value of "QUORUM", which is generic enough to not require changes in the near future.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org