dstandish commented on code in PR #31241:
URL: https://github.com/apache/airflow/pull/31241#discussion_r1260020669


##########
airflow/utils/log/file_task_handler.py:
##########
@@ -218,9 +242,12 @@ def close(self):
         if self.handler:
             self.handler.close()
 
-    def _render_filename(self, ti: TaskInstance, try_number: int) -> str:
+    def _render_filename(self, ti: TaskInstance | TaskInstanceKey, try_number: 
int) -> str:
         """Returns the worker log filename."""
+        from airflow.models.taskinstance import TaskInstance
+
         with create_session() as session:
+            ti = TaskInstance.from_ti(ti, session=session)
             dag_run = ti.get_dagrun(session=session)

Review Comment:
   similar to above, I suspect that there is an optimization here, if 
USE_PER_RUN_LOG_ID  is false, then we should not need to go to the database i 
think.  this is probably not a huge issue on individual task logging i.e. on 
the worker but from something like scheduler you would probably want to avoid 
queries.  though, not sure if it's really possible given the templating etc.



-- 
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