uranusjr commented on a change in pull request #20165:
URL: https://github.com/apache/airflow/pull/20165#discussion_r766228211



##########
File path: airflow/models/dagrun.py
##########
@@ -931,3 +945,13 @@ def schedule_tis(self, schedulable_tis: Iterable[TI], 
session: Session = NEW_SES
             )
 
         return count
+
+    @provide_session
+    def get_log_filename_template(self, *, session: Session = NEW_SESSION) -> 
Optional[str]:
+        if self.log_filename_id is None:  # DagRun created before LogFilename 
introduction.
+            template = 
session.query(LogFilename.template).order_by(LogFilename.id).limit(1).scalar()
+        else:
+            template = 
session.query(LogFilename.template).filter_by(id=self.log_filename_id).one_or_none()

Review comment:
       Neither of the branches should ever return None, in fact, because we 
always ensure there’s a row on startup. I’ll change this to raise an error if 
None is returned, that makes things more explicit.




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