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 2021/12/13 18:20:50 UTC

[GitHub] [airflow] wolfier commented on a change in pull request #20224: Fix start date for following sensor reschedule

wolfier commented on a change in pull request #20224:
URL: https://github.com/apache/airflow/pull/20224#discussion_r768009733



##########
File path: airflow/models/taskinstance.py
##########
@@ -1204,10 +1204,12 @@ def check_and_change_state_before_execution(
             # For reporting purposes, we report based on 1-indexed,
             # not 0-indexed lists (i.e. Attempt 1 instead of
             # Attempt 0 for the first attempt).
-            # Set the task start date. In case it was re-scheduled use the initial
-            # start date that is recorded in task_reschedule table
+            # Set the task start date.
             self.start_date = timezone.utcnow()
-            if self.state == State.UP_FOR_RESCHEDULE:
+
+            # In case it was re-scheduled use the initial
+            # start date that is recorded in task_reschedule table
+            if hasattr(self.task, 'reschedule') and self.task.reschedule:

Review comment:
       Ahh, good point!
   
   Since any operator can raise `AirflowRescheduleException`, how would I distinguish between tasks that are being rescheduled? Would I need to query the `task_reschedule` table for all tasks? This would remove the original optimization though maybe it doesn't make sense to have it in the first place.




-- 
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-unsubscribe@airflow.apache.org

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