ashb commented on code in PR #25419:
URL: https://github.com/apache/airflow/pull/25419#discussion_r948990643


##########
airflow/datasets/manager.py:
##########
@@ -0,0 +1,62 @@
+#
+# 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.
+from sqlalchemy.orm.session import Session
+
+from airflow.utils.log.logging_mixin import LoggingMixin
+
+
+class DatasetEventManager(LoggingMixin):
+    """
+    A pluggable class that manages operations for dataset events.
+
+    The intent is to have one place to handle all DatasetEvent-related 
operations, so different
+    Airflow deployments can use plugins that broadcast dataset events to each 
other.
+    """
+
+    def register_dataset_change(self, *, task_instance, dataset, extra=None, 
session: Session) -> None:
+        """
+        For local datasets, look them up, record the dataset event, queue 
dagruns, and broadcast
+        the dataset event
+        """
+        from airflow.datasets import Dataset
+        from airflow.models.dataset import DatasetEvent, DatasetModel
+
+        if isinstance(dataset, Dataset):

Review Comment:
   When would a dataset not be a dataset? Shouldn't we do this check at the 
caller instead?



-- 
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