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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]