From abe5f7c68bda057396744cb70c43e9cb83c02aac 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) --- 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 561564a5e9323..8b155e7b526a0 100644 --- a/airflow/models/dagbag.py +++ b/airflow/models/dagbag.py @@ -46,6 +46,7 @@ AirflowDagCycleException, AirflowDagDuplicatedIdException, AirflowException, + AirflowTaskTimeout, ) from airflow.listeners.listener import get_listener_manager from airflow.models.base import Base @@ -350,7 +351,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: