From bb12e6b7eae2f82d1d5befc1257d2d5bc08f837a Mon Sep 17 00:00:00 2001 From: Pavan Sharma Date: Tue, 12 Nov 2024 17:54:53 +0530 Subject: [PATCH] terminate kubernetes watch in case of unknown error (#43645) --- .../cncf/kubernetes/executors/kubernetes_executor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py index 1e2779a575528..3300f3cf96d4a 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py +++ b/providers/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py @@ -773,8 +773,13 @@ def end(self) -> None: self.result_queue.join() except ConnectionResetError: self.log.exception("Connection Reset error while flushing task_queue and result_queue.") + except Exception: + self.log.exception("Unknown error while flushing task queue and result queue.") if self.kube_scheduler: - self.kube_scheduler.terminate() + try: + self.kube_scheduler.terminate() + except Exception: + self.log.exception("Unknown error while flushing task queue and result queue.") self._manager.shutdown() def terminate(self):