ashb commented on a change in pull request #5372: [AIRFLOW-3057] add 
prev_*_date_success to template context
URL: https://github.com/apache/airflow/pull/5372#discussion_r291246847
 
 

 ##########
 File path: airflow/models/dagrun.py
 ##########
 @@ -218,12 +219,19 @@ def get_dag(self):
         return self.dag
 
     @provide_session
-    def get_previous_dagrun(self, session=None):
+    def get_previous_dagrun(self, session: Session = None, state: str = None) 
-> Optional['DagRun']:
         """The previous DagRun, if there is one"""
 
-        return session.query(DagRun).filter(
+        assert isinstance(session, Session)  # mypy
 
 Review comment:
   @pgagnon Yes, but then it can't be after other optional arguments, and the 
entire rest of the codebase where we use `@provide_session` has `session=None` 
as the last kwarg in functions.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to