You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/04 09:38:59 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #9087: Query TaskReschedule only if task is UP_FOR_RESCHEDULE

mik-laj commented on a change in pull request #9087:
URL: https://github.com/apache/airflow/pull/9087#discussion_r435123959



##########
File path: airflow/ti_deps/deps/ready_to_reschedule.py
##########
@@ -52,14 +52,14 @@ def _get_dep_statuses(self, ti, session, dep_context):
                 reason="The task instance is not in State_UP_FOR_RESCHEDULE or NONE state.")
             return
 
-        task_reschedules = TaskReschedule.find_for_task_instance(task_instance=ti)
-        if not task_reschedules:
+        task_reschedule = TaskReschedule.query_for_task_instance(task_instance=ti, descending=True).first()

Review comment:
       ```suggestion
           task_reschedule = (
               TaskReschedule.query_for_task_instance(task_instance=ti, descending=True)
               .with_entities(TR.reschedule_date)
               .first()
           )
   ```




----------------------------------------------------------------
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:
users@infra.apache.org