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 16:55:06 UTC

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

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



##########
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:
       So, one issue with this is, sensors are not the only reschedulable operators.   Any operator can raise `AirflowRescheduleException` and  produce the same behavior.  I don't think we can infer what to do based on  looking at task type or attributes.




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