potiuk commented on code in PR #28900:
URL: https://github.com/apache/airflow/pull/28900#discussion_r1308441589


##########
airflow/models/dagrun.py:
##########
@@ -519,27 +566,44 @@ def get_dag(self) -> DAG:
 
         return self.dag
 
+    @staticmethod
+    @internal_api_call
     @provide_session
     def get_previous_dagrun(
-        self, state: DagRunState | None = None, session: Session = NEW_SESSION
+        dag_run: DagRun | DagRunPydantic, state: DagRunState | None = None, 
session: Session = NEW_SESSION
     ) -> DagRun | None:
-        """Return the previous DagRun, if there is one."""
+        """
+        Return the previous DagRun, if there is one.
+
+        :param dag_run: the dag run
+        :param session: SQLAlchemy ORM Session
+        :param state: the dag run state
+        """
         filters = [
-            DagRun.dag_id == self.dag_id,
-            DagRun.execution_date < self.execution_date,
+            DagRun.dag_id == dag_run.dag_id,
+            DagRun.execution_date < dag_run.execution_date,
         ]
         if state is not None:
             filters.append(DagRun.state == state)
         return 
session.scalar(select(DagRun).where(*filters).order_by(DagRun.execution_date.desc()))
 
+    @staticmethod
+    @internal_api_call
     @provide_session
-    def get_previous_scheduled_dagrun(self, session: Session = NEW_SESSION) -> 
DagRun | None:
-        """Return the previous SCHEDULED DagRun, if there is one."""
+    def get_previous_scheduled_dagrun(
+        dag_run: DagRun | DagRunPydantic, session: Session = NEW_SESSION

Review Comment:
   and here.



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