ferruzzi commented on code in PR #61153:
URL: https://github.com/apache/airflow/pull/61153#discussion_r2791087259


##########
airflow-core/src/airflow/executors/workloads/base.py:
##########
@@ -0,0 +1,82 @@
+# 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.
+"""ORM models and Pydantic schemas for BaseWorkload."""
+
+from __future__ import annotations
+
+import os
+from abc import ABC
+from typing import TYPE_CHECKING
+
+from pydantic import BaseModel
+
+if TYPE_CHECKING:
+    from airflow.api_fastapi.auth.tokens import JWTGenerator
+
+
+class BaseWorkload:
+    """
+    Mixin for ORM models that can be scheduled as workloads.
+
+    This mixin defines the interface that scheduler workloads (TaskInstance,
+    ExecutorCallback, etc.) must implement to provide routing information to 
the scheduler.
+
+    Subclasses must override:
+    - get_dag_id() -> str | None
+    - get_executor_name() -> str | None
+    """
+
+    def get_dag_id(self) -> str | None:
+        """
+        Return the DAG ID for scheduler routing.
+
+        Must be implemented by subclasses.
+        """
+        raise NotImplementedError(f"{self.__class__.__name__} must implement 
get_dag_id()")
+
+    def get_executor_name(self) -> str | None:
+        """
+        Return the executor name for scheduler routing.
+
+        Must be implemented by subclasses.
+        """
+        raise NotImplementedError(f"{self.__class__.__name__} must implement 
get_executor_name()")
+
+
+class BundleInfo(BaseModel):
+    """Schema for telling task which bundle to run with."""
+
+    name: str
+    version: str | None = None
+
+
+class BaseWorkloadSchema(BaseModel):
+    """Base Pydantic schema for executor workload DTOs."""
+
+    token: str  # The identity token for this workload.

Review Comment:
   two hard things....   Yours is much better.



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