Taragolis commented on code in PR #33720:
URL: https://github.com/apache/airflow/pull/33720#discussion_r1310007883
##########
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:
I've implement by this way due to difference between legacy Query API and
new Statement Based (i don't know correct name): you don't have to provide a DB
session for build query statement
We could directly use `stmt_for_task_instance` into
- airflow/models/taskinstance.py
- airflow/ti_deps/deps/ready_to_reschedule.py
Unfortunetly we can't do that in `airflow/sensors/base.py`, because we do
not open session here, however it is not a showstopper, if applicable I could
create private method in `BaseSensorOperator` which would open a session,
execute query against `stmt_for_task_instance` and return start_date
--
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]