From 47fb46c56277e111cfbee246e119608f456a77f4 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Fri, 20 Dec 2024 08:22:16 +0000 Subject: [PATCH] Attempt to work around RuntimeError: UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS --- cosmos/listeners/dag_run_listener.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cosmos/listeners/dag_run_listener.py b/cosmos/listeners/dag_run_listener.py index 1712e4250..2b0b60698 100644 --- a/cosmos/listeners/dag_run_listener.py +++ b/cosmos/listeners/dag_run_listener.py @@ -47,8 +47,12 @@ def uses_cosmos(dag: DAG) -> bool: return bool(is_cosmos_dag(dag) or total_cosmos_task_groups(dag) or total_cosmos_tasks(dag)) +from airflow.utils.session import provide_session + + +@provide_session @hookimpl -def on_dag_run_success(dag_run: DagRun, msg: str) -> None: +def on_dag_run_success(dag_run: DagRun, msg: str, session=None) -> None: logger.info(f"dir: {dir(dag_run.dag)}") logger.info("The on_dag_run_success was called")