shoemoney commented on code in PR #72068:
URL: https://github.com/apache/airflow/pull/72068#discussion_r4057418369


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -986,7 +986,10 @@ def extract_xcom(self, pod: V1Pod) -> str:
             result = self.extract_xcom_json(pod)
             return result
         finally:
-            self.extract_xcom_kill(pod)
+            try:
+                self.extract_xcom_kill(pod)
+            except PodCommandException:

Review Comment:
   Scoped the swallow so the Job path still fails, in 
c3e8cc219a946d0cd41d2b6173306a25c6eef672. extract_xcom takes a keyword-only 
ignore_kill_failure defaulting to True, and KubernetesJobOperator.execute 
passes ignore_kill_failure=False, so a kill failure propagates before 
wait_until_job_complete is reached and that path behaves exactly as it did 
before this PR. I preferred this to re-checking container_is_running on the 
sidecar after extraction, because a successful kill does not make the container 
report terminated instantly and that check would fail the happy path 
intermittently. Covered by 
test_xcom_sidecar_kill_failure_fails_job_instead_of_hanging in test_job.py, 
which asserts the raise and that wait_until_job_complete is never called. It 
fails if the argument is removed.



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -986,7 +986,10 @@ def extract_xcom(self, pod: V1Pod) -> str:
             result = self.extract_xcom_json(pod)
             return result
         finally:
-            self.extract_xcom_kill(pod)
+            try:
+                self.extract_xcom_kill(pod)
+            except PodCommandException:
+                self.log.warning("Failed to kill xcom sidecar container, 
skipping")

Review Comment:
   Adopted your wording verbatim in c3e8cc219a946d0cd41d2b6173306a25c6eef672. 
The warning now names the pod, says the sidecar is left running, and includes 
the exception.



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