uranusjr commented on a change in pull request #20062:
URL: https://github.com/apache/airflow/pull/20062#discussion_r762953978
##########
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:
What would `start_date` be if the task is not deferred? If it’s `None`,
perhaps a better solution would be
```python
if self.start_date is None:
self.start_date = timezone.utcnow()
```
but perhaps it would not be None when being rescheduled? I guess what I’m
trying to say is we might want to consider more context for this, since relying
on `next_method` is a bit unstable since that value is meaning something else
and it’s too easy to change its logic elsewhere without realising it causes
side effect here.
--
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]