This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch task-sdk-first-code
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 5848de44993967739162646b8f53a7308592bd9a
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Tue Oct 29 14:34:40 2024 +0000

    [skip-ci]
---
 airflow/models/baseoperator.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/airflow/models/baseoperator.py b/airflow/models/baseoperator.py
index e0ef0764406..d283a123490 100644
--- a/airflow/models/baseoperator.py
+++ b/airflow/models/baseoperator.py
@@ -43,6 +43,7 @@ from typing import (
     TypeVar,
 )
 
+import methodtools
 import pendulum
 from sqlalchemy import select
 from sqlalchemy.orm.exc import NoResultFound
@@ -605,8 +606,6 @@ class BaseOperator(TaskSDKBaseOperator, AbstractOperator, 
metaclass=BaseOperator
     on_success_callback: None | TaskStateChangeCallback | 
list[TaskStateChangeCallback] = None
     on_retry_callback: None | TaskStateChangeCallback | 
list[TaskStateChangeCallback] = None
     on_skipped_callback: None | TaskStateChangeCallback | 
list[TaskStateChangeCallback] = None
-    _is_setup: bool = False
-    _is_teardown: bool = False
 
     def __init__(
         self,
@@ -648,6 +647,22 @@ class BaseOperator(TaskSDKBaseOperator, AbstractOperator, 
metaclass=BaseOperator
 
     partial: Callable[..., OperatorPartial] = _PartialDescriptor()  # type: 
ignore
 
+    @classmethod
+    @methodtools.lru_cache(maxsize=None)
+    def get_serialized_fields(cls):
+        """Stringified DAGs and operators contain exactly these fields."""
+        # TODO: this ends up caching it once per-subclass, which isn't what we 
want, but this class is only
+        # kept around during the development of AIP-72/TaskSDK code.
+        return TaskSDKBaseOperator.get_serialized_fields() | {
+            "start_trigger_args",
+            "start_from_trigger",
+            "on_execute_callback",
+            "on_failure_callback",
+            "on_success_callback",
+            "on_retry_callback",
+            "on_skipped_callback",
+        }
+
     def get_inlet_defs(self):
         """
         Get inlet definitions on this task.

Reply via email to