From 485155ddf1a758f94a2dce9e225928b0241c4ea8 Mon Sep 17 00:00:00 2001 From: VladaZakharova Date: Fri, 6 Sep 2024 21:04:06 +0200 Subject: [PATCH] Add new type of exception to catch timeout (#42064) (cherry picked from commit abe5f7c68bda057396744cb70c43e9cb83c02aac) --- airflow/models/dagbag.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airflow/models/dagbag.py b/airflow/models/dagbag.py index f384bfcd84ea..761a88c0ea9a 100644 --- a/airflow/models/dagbag.py +++ b/airflow/models/dagbag.py @@ -47,6 +47,7 @@ AirflowDagCycleException, AirflowDagDuplicatedIdException, AirflowException, + AirflowTaskTimeout, RemovedInAirflow3Warning, ) from airflow.listeners.listener import get_listener_manager @@ -381,7 +382,7 @@ def parse(mod_name, filepath): sys.modules[spec.name] = new_module loader.exec_module(new_module) return [new_module] - except Exception as e: + except (Exception, AirflowTaskTimeout) as e: DagContext.autoregistered_dags.clear() self.log.exception("Failed to import: %s", filepath) if self.dagbag_import_error_tracebacks: