insomnes commented on code in PR #47187:
URL: https://github.com/apache/airflow/pull/47187#discussion_r1977922020


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/triggers/pod.py:
##########
@@ -257,19 +259,30 @@ async def _wait_for_container_completion(self) -> 
TriggerEvent:
             self.log.debug("Sleeping for %s seconds.", self.poll_interval)
             await asyncio.sleep(self.poll_interval)
 
-    def _get_async_hook(self) -> AsyncKubernetesHook:
-        # TODO: Remove this method when the min version of kubernetes provider 
is 7.12.0 in Google provider.
+    @tenacity.retry(stop=tenacity.stop_after_attempt(3), 
wait=tenacity.wait_exponential(), reraise=True)
+    async def _get_pod(self) -> V1Pod:
+        """
+        Get the pod from Kubernetes.
+
+        Separate method for retrying. Retry logic here should mimic the retry 
logic in
+        PodManager.read_pod method.
+        """
+        pod = await self.hook.get_pod(name=self.pod_name, 
namespace=self.pod_namespace)
+        # Due to AsyncKubernetesHook overriding get_pod, we need to cast the 
return
+        # value to kubernetes_asyncio.V1Pod, because it's perceived as 
different type
+        if TYPE_CHECKING:
+            pod = cast(V1Pod, pod)
+        return pod

Review Comment:
   This would require extracting `V1Pod` import outside of `if TYPE_CHECKING` 
import block. I am not sure that it is a reasonable thing to do here.



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