You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/03 01:40:39 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #19359: Task should fail immediately when pod is unprocessable

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



##########
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.reason in ("BadRequest", "Unprocessable Entity"):
+                        self.log.error(f"Pod creation failed with reason {e.reason!r}. Failing task")

Review comment:
       One reason (uh) against using `reason` is it's more brittle. `reason` is intended as human readable and could potentially change (e.g. `BadRequest` to `Bad Request`), while the status code is for machines and more suitable for Airflow's use case here IMO.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org