dstandish commented on a change in pull request #19359:
URL: https://github.com/apache/airflow/pull/19359#discussion_r742149639



##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -599,13 +599,14 @@ def sync(self) -> None:
                 try:
                     self.kube_scheduler.run_next(task)
                 except ApiException as e:
-                    if e.reason == "BadRequest":
-                        self.log.error("Request was invalid. Failing task")
+                    if e.status in (400, 422):
+                        self.log.error("Pod creation failed with reason %r. 
Failing task", e.reason)

Review comment:
       in this case, the exception is already logged within `run_pod_async`, 
which catches, logs, and reraises.
   
   probably anything that is going to immediately reraise shouldn't bother 
logging (so that the logging is controlled by whatever is handling the 
exception).  but in this case, that's what the code does so it is probably 
better to only log once, because it can be a bit verbose. lmkyt




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