eskarimov commented on a change in pull request #20062:
URL: https://github.com/apache/airflow/pull/20062#discussion_r763154994



##########
File path: airflow/models/taskinstance.py
##########
@@ -1200,7 +1200,8 @@ def check_and_change_state_before_execution(
             # 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
-            self.start_date = timezone.utcnow()
+            # If the task continues after being deferred (next_method is set), 
use the original start_date
+            self.start_date = self.start_date if self.next_method else 
timezone.utcnow()

Review comment:
       You're totally right, when a new task instance starts the first time, 
then `start_date` would be `None`.
   In case a task was rescheduled, then `start_date` would be equal to the 
previous run attempt.
   
   Does it make sense to consider setting `start_date` to `None` when we clear 
the task instance?
   
https://github.com/apache/airflow/blob/1349cc62df9fa872fd24865ade7b281bb229d70c/airflow/models/taskinstance.py#L202-L204




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


Reply via email to