From e0420dc785eec7ff243e7e7b6ec31b7af901c596 Mon Sep 17 00:00:00 2001 From: Daniel Standish <15932138+dstandish@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:33:36 -0700 Subject: [PATCH] Implement get_log_template on DagRunPydantic Also one drive-by fix removing unnecessary provide_session. --- airflow/serialization/pydantic/dag_run.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/airflow/serialization/pydantic/dag_run.py b/airflow/serialization/pydantic/dag_run.py index 65133ad50dbae..1263ddae2cb71 100644 --- a/airflow/serialization/pydantic/dag_run.py +++ b/airflow/serialization/pydantic/dag_run.py @@ -75,11 +75,10 @@ def get_task_instances( """ raise NotImplementedError() - @provide_session def get_task_instance( self, task_id: str, - session: Session = NEW_SESSION, + session: Session, *, map_index: int = -1, ) -> TI | TaskInstancePydantic | None: @@ -99,6 +98,11 @@ def get_task_instance( map_index=map_index, ) + def get_log_template(self, session: Session): + from airflow.models.dagrun import DagRun + + return DagRun._get_log_template(log_template_id=self.log_template_id) + if is_pydantic_2_installed(): DagRunPydantic.model_rebuild()