You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/03 23:52:46 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #24153: Apply per-run log templates to log handlers

uranusjr commented on code in PR #24153:
URL: https://github.com/apache/airflow/pull/24153#discussion_r889416845


##########
airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -103,7 +112,10 @@ def __init__(
         self.handler: Union[logging.FileHandler, logging.StreamHandler]  # type: ignore[assignment]
 
     def _render_log_id(self, ti: TaskInstance, try_number: int) -> str:
-        dag_run = ti.get_dagrun()
+        with create_session() as session:
+            dag_run = ti.get_dagrun(session=session)
+            log_id_template = dag_run.get_log_template(session=session).elasticsearch_id

Review Comment:
   Ah, right. I think we can simply detect whether there’s a `LogTemplate` model.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org