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_r291099645
 
 

 ##########
 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:
   Could you test something @dstandish: what happens if you remove the `=None` 
on the session and this assert? because of the decorator it will never be 
passed with None in anyway.

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


With regards,
Apache Git Services

Reply via email to