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


##########
airflow/models/xcom.py:
##########
@@ -490,44 +312,21 @@ class LazyXComSelectSequence(LazySelectSequence[Any]):
 
     @staticmethod
     def _rebuild_select(stmt: TextClause) -> Select:
-        return select(XCom.value).from_statement(stmt)
+        return select(XComModel.value).from_statement(stmt)
 
     @staticmethod
     def _process_row(row: Row) -> Any:
-        return XCom.deserialize_value(row)
-
-
-def _get_function_params(function) -> list[str]:
-    """
-    Return the list of variables names of a function.
-
-    :param function: The function to inspect
-    """
-    parameters = inspect.signature(function).parameters
-    bound_arguments = [
-        name for name, p in parameters.items() if p.kind not in 
(p.VAR_POSITIONAL, p.VAR_KEYWORD)
-    ]
-    return bound_arguments
-
-
-def resolve_xcom_backend() -> type[BaseXCom]:
-    """
-    Resolve custom XCom class.
-
-    Confirm that custom XCom class extends the BaseXCom.
-    Compare the function signature of the custom XCom serialize_value to the 
base XCom serialize_value.
-    """
-    clazz = conf.getimport("core", "xcom_backend", 
fallback=f"airflow.models.xcom.{BaseXCom.__name__}")
-    if not clazz:
-        return BaseXCom
-    if not issubclass(clazz, BaseXCom):
-        raise TypeError(
-            f"Your custom XCom class `{clazz.__name__}` is not a subclass of 
`{BaseXCom.__name__}`."
-        )
-    return clazz
+        return XComModel.deserialize_value(row)
 
 
 if TYPE_CHECKING:
-    XCom = BaseXCom  # Hack to avoid Mypy "Variable 'XCom' is not valid as a 
type".
+    XCom = XComModel
 else:
-    XCom = resolve_xcom_backend()
+    XCom = airflow.sdk.execution_time.xcom.resolve_xcom_backend()
+
+
+# 1. Implement DELETE API -- run endpoint should return keys and those should 
eb called by worker. ✅
+# 2. (Do not clear during xcom during /run) ✅
+# 3. Wipe out BaseXcom in models ✅
+# 4. Purge after getting the ctx then delete request (XCOM.delete also)
+# 5. Lazy import from task sdk: __get_attr__ ✅

Review Comment:
   Yeah, the lazy import should be in this module as a back-compat shim I think



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