svdimchenko commented on code in PR #31595:
URL: https://github.com/apache/airflow/pull/31595#discussion_r1209290882


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -696,10 +698,11 @@ def cleanup(self, pod: k8s.V1Pod, remote_pod: k8s.V1Pod):
                         f"Pod {pod and pod.metadata.name} returned exit code "
                         f"{self.skip_on_exit_code}. Skipping."
                     )
-            raise AirflowException(
-                f"Pod {pod and pod.metadata.name} returned a 
failure:\n{error_message}\n"
-                f"remote_pod: {remote_pod}"
-            )
+            raise AirflowException('\n'.join(filter(None, [
+                f"Pod {pod and pod.metadata.name} returned a failure.",
+                error_message,
+                f"remote_pod: {remote_pod}" if self.log_pod_on_failure else 
None

Review Comment:
   if we set it to None, we can easily filter this message out with `filter` 
usage. So that we'll log only messages with reasonable values.



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