potiuk commented on code in PR #61880:
URL: https://github.com/apache/airflow/pull/61880#discussion_r2807362520


##########
airflow/models/dagrun.py:
##########
@@ -1648,9 +1648,25 @@ def schedule_tis(
         return count
 
     @provide_session
-    def get_log_template(self, *, session: Session = NEW_SESSION) -> 
LogTemplate | LogTemplatePydantic:
+    def get_db_log_template(self, *, session: Session = NEW_SESSION) -> 
LogTemplate | LogTemplatePydantic:
         return DagRun._get_log_template(log_template_id=self.log_template_id, 
session=session)
 
+    @provide_session
+    def get_log_template(
+        self, session: Session = NEW_SESSION
+    ) -> LogTemplate | LogTemplatePydantic | LogTemplateDataClass:
+        if airflow_conf.getboolean("core", 
"use_historical_filename_templates", fallback=False):
+            return self.get_db_log_template(session=session)
+        else:
+            return LogTemplateDataClass(
+                filename=airflow_conf.get_mandatory_value("core", 
"log_filename_template"),
+                elasticsearch_id=airflow_conf.get(
+                    "elasticsearch",
+                    "log_id_template",
+                    
fallback="{dag_id}-{task_id}-{run_id}-{map_index}-{try_number}",

Review Comment:
   Not really - that's a string that is already default  - the `{{` is only 
needed  when we read it from config and where it is processed first by Jinja 
template. But yeah - I will double check if this works as expected (also this 
fallback is not going to be used most likely - it's only in case the code is 
run before ProvidersManager discovery - because once providers manager 
processes it, there is a default defined from provider.yaml.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to