You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ramitkataria (via GitHub)" <gi...@apache.org> on 2025/10/03 19:13:16 UTC

Re: [PR] Introduce generic Callbacks to support running callbacks on executors [airflow]

ramitkataria commented on code in PR #54796:
URL: https://github.com/apache/airflow/pull/54796#discussion_r2403092317


##########
airflow-core/src/airflow/executors/workloads.py:
##########
@@ -97,6 +107,13 @@ class ExecuteTask(BaseWorkload):
     log_path: str | None
     """The rendered relative log filename template the task logs should be written to"""
 
+
+class ExecuteTask(BaseDagBundleWorkload):
+    """Execute the given Task."""
+
+    ti: TaskInstance
+    """The TaskInstance to execute"""

Review Comment:
   Removed it - it got there because I copied it from the previous definition of ExecuteTask



##########
airflow-core/src/airflow/models/callback.py:
##########
@@ -0,0 +1,177 @@
+# 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 __future__ import annotations
+
+import logging
+from enum import Enum
+from importlib import import_module
+from typing import TYPE_CHECKING
+
+import uuid6
+from sqlalchemy import Column, ForeignKey, Integer, String, Text
+from sqlalchemy.orm import relationship
+from sqlalchemy_utils import UUIDType
+
+from airflow._shared.timezones import timezone
+from airflow.models import Base
+from airflow.utils.sqlalchemy import ExtendedJSON, UtcDateTime
+
+if TYPE_CHECKING:
+    from sqlalchemy.orm import Session
+
+    from airflow.callbacks.callback_requests import CallbackRequest
+    from airflow.triggers.base import TriggerEvent
+
+log = logging.getLogger(__name__)
+
+
+class CallbackState(str, Enum):
+    """All possible states of callbacks."""
+
+    PENDING = "pending"
+    QUEUED = "queued"
+    RUNNING = "running"
+    SUCCESS = "success"
+    FAILED = "failed"
+
+
+class CallbackType(str, Enum):
+    """
+    Types of Callbacks.
+
+    Used for figuring out what class to instantiate while deserialization.
+    """
+
+    TRIGGERER = "triggerer"
+    EXECUTOR = "executor"
+    DAG_PROCESSOR = "dag_processor"
+
+
+class CallbackFetchMethod(str, Enum):
+    """Methods used to fetch callback at runtime."""
+
+    # For when Dag Processor callbacks (on_success_callback/on_failure_callback) once they get moved to executors

Review Comment:
   Fixed!



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