pankajastro commented on code in PR #37363:
URL: https://github.com/apache/airflow/pull/37363#discussion_r1489286411


##########
airflow/providers/cncf/kubernetes/triggers/pod.py:
##########
@@ -155,18 +155,32 @@ def serialize(self) -> tuple[str, dict[str, Any]]:
             },
         )
 
+    def _get_terminal_event(self, state) -> TriggerEvent:
+        if state == PodPhase.SUCCEEDED:
+            status = "success"
+        else:
+            status = "failed"
+        return TriggerEvent({"status": status, "namespace": 
self.pod_namespace, "name": self.pod_name})
+
     async def run(self) -> AsyncIterator[TriggerEvent]:  # type: 
ignore[override]
         """Get current pod status and yield a TriggerEvent."""
         self.log.info("Checking pod %r in namespace %r.", self.pod_name, 
self.pod_namespace)
         try:
             state = await self._wait_for_pod_start()
             if state in PodPhase.terminal_states:
-                event = TriggerEvent(
-                    {"status": "done", "namespace": self.pod_namespace, 
"pod_name": self.pod_name}
-                )
+                event = self._get_terminal_event(state)
             else:
                 event = await self._wait_for_container_completion()
             yield event
+        except PodLaunchTimeoutException as e:
+            description = self._format_exception_description(e)
+            yield TriggerEvent(
+                {
+                    "status": "timeout",
+                    "error_type": e.__class__.__name__,
+                    "description": description,
+                }
+            )
         except Exception as e:

Review Comment:
   status "cancelled" was unused in operator  and cleanup happens in operator 
this should not require 



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