Copilot commented on code in PR #67895:
URL: https://github.com/apache/airflow/pull/67895#discussion_r3362241107


##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -650,9 +650,9 @@ def deserialize(cls, encoded_var: Any) -> Any:
             if not _has_kubernetes(attempt_import=True):
                 raise RuntimeError(
                     "Cannot deserialize POD objects without kubernetes 
libraries. "
-                    "Please install the cncf.kubernetes provider."
+                    "Please install the `kubernetes` package."
                 )
-            pod = PodGenerator.deserialize_model_dict(var)
+            pod = ApiClient()._ApiClient__deserialize_model(var, k8s.V1Pod)

Review Comment:
   `ApiClient()._ApiClient__deserialize_model(...)` is a private, name-mangled 
method. This is the same approach used by the (now-decoupled) PodGenerator, but 
in airflow-core it would help future maintainers to document why we’re relying 
on a private kubernetes-client API (and link to the upstream issue) to avoid 
accidental “cleanup” later.



##########
airflow-core/src/airflow/utils/sqlalchemy.py:
##########
@@ -251,11 +251,11 @@ def ensure_pod_is_valid_after_unpickling(pod: V1Pod) -> 
V1Pod | None:
     if not isinstance(pod, V1Pod):
         return None
     try:
-        from airflow.providers.cncf.kubernetes.pod_generator import 
PodGenerator
+        from kubernetes.client.api_client import ApiClient
 
         # now we actually reserialize / deserialize the pod
         pod_dict = sanitize_for_serialization(pod)
-        return PodGenerator.deserialize_model_dict(pod_dict)
+        return ApiClient()._ApiClient__deserialize_model(pod_dict, V1Pod)

Review Comment:
   This relies on `ApiClient()._ApiClient__deserialize_model(...)`, which is a 
private kubernetes-client method. Since this is now in airflow-core (and not 
hidden behind the provider’s PodGenerator), it should be documented inline 
(with the upstream issue link) so future refactors don’t inadvertently 
remove/replace it with something incompatible.



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