uranusjr commented on code in PR #33720:
URL: https://github.com/apache/airflow/pull/33720#discussion_r1309968634


##########
airflow/models/taskreschedule.py:
##########
@@ -142,9 +154,93 @@ def find_for_task_instance(
         :param try_number: Look for TaskReschedule of the given try_number. 
Default is None which
             looks for the same try_number of the given task_instance.
         """
-        return TaskReschedule.query_for_task_instance(
-            task_instance, session=session, try_number=try_number
-        ).all()
+        return session.scalars(cls.stmt_for_task_instance(task_instance, 
try_number=try_number)).all()
+
+    @classmethod
+    @provide_session
+    def find_last_for_task_instance(

Review Comment:
   But I we don’t really need `find_task_reschedule_for_ti` and 
`find_task_reschedules_for_ti` since those are just one liners that pass most 
of the arguments (except `session`) to `stmt_for_task_instance` anyway. We can 
just call `stmt_for_task_instance` and execute the statement as appropriated 
directly where needed.



##########
airflow/models/taskreschedule.py:
##########
@@ -142,9 +154,93 @@ def find_for_task_instance(
         :param try_number: Look for TaskReschedule of the given try_number. 
Default is None which
             looks for the same try_number of the given task_instance.
         """
-        return TaskReschedule.query_for_task_instance(
-            task_instance, session=session, try_number=try_number
-        ).all()
+        return session.scalars(cls.stmt_for_task_instance(task_instance, 
try_number=try_number)).all()
+
+    @classmethod
+    @provide_session
+    def find_last_for_task_instance(

Review Comment:
   But I we don’t really need `find_task_reschedule_for_ti` and 
`find_task_reschedules_for_ti` since those are just one liners that pass most 
of the arguments (except `session`) to `stmt_for_task_instance` anyway. We can 
just call `stmt_for_task_instance` and execute the statement as appropriated 
directly where needed.



##########
airflow/models/taskreschedule.py:
##########
@@ -142,9 +154,93 @@ def find_for_task_instance(
         :param try_number: Look for TaskReschedule of the given try_number. 
Default is None which
             looks for the same try_number of the given task_instance.
         """
-        return TaskReschedule.query_for_task_instance(
-            task_instance, session=session, try_number=try_number
-        ).all()
+        return session.scalars(cls.stmt_for_task_instance(task_instance, 
try_number=try_number)).all()
+
+    @classmethod
+    @provide_session
+    def find_last_for_task_instance(

Review Comment:
   But I mean we don’t really need `find_task_reschedule_for_ti` and 
`find_task_reschedules_for_ti` since those are just one liners that pass most 
of the arguments (except `session`) to `stmt_for_task_instance` anyway. We can 
just call `stmt_for_task_instance` and execute the statement as appropriated 
directly where needed.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to