perry2of5 commented on code in PR #48557:
URL: https://github.com/apache/airflow/pull/48557#discussion_r2178644517
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1114,12 +1114,15 @@ def next_retry_datetime(self):
delay = self.task.retry_delay
if self.task.retry_exponential_backoff:
- # If the min_backoff calculation is below 1, it will be converted
to 0 via int. Thus,
- # we must round up prior to converting to an int, otherwise a
divide by zero error
- # will occur in the modded_hash calculation.
- # this probably gives unexpected results if a task instance has
previously been cleared,
- # because try_number can increase without bound
- min_backoff = math.ceil(delay.total_seconds() * (2 **
(self.try_number - 1)))
+ try:
+ # If the min_backoff calculation is below 1, it will be
converted to 0 via int. Thus,
+ # we must round up prior to converting to an int, otherwise a
divide by zero error
+ # will occur in the modded_hash calculation.
+ # this probably gives unexpected results if a task instance
has previously been cleared,
+ # because try_number can increase without bound
+ min_backoff = math.ceil(delay.total_seconds() * (2 **
(self.try_number - 1)))
+ except OverflowError:
+ min_backoff = MAX_RETRY_DELAY
Review Comment:
I added a log message. I think it is inconsistent to log when the
calculation is capped due to overflow, but not when capped due to exceeding the
maximum, but it does no harm. Better than crashing!
--
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]