ashb commented on a change in pull request #20165:
URL: https://github.com/apache/airflow/pull/20165#discussion_r765912617
##########
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:
```suggestion
template =
session.query(LogFilename.template).get(self.log_filename_id)
```
This shouldn't ever return None because of the RESTRICT FK.
--
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]