Exponential Backoff Not Functioning in BaseSensorOperator Reschedule Mode#39823
Conversation
…t exponential backoff in reschedule mode.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
To reproduce: from airflow.models.dag import DAG
from airflow.sensors.base import BaseSensorOperator
class DummySensor(BaseSensorOperator):
def __init__(self, return_value=False, **kwargs):
super().__init__(**kwargs)
self.return_value = return_value
def poke(self, context):
return self.return_value
with DAG(dag_id="base_sensor_test") as d:
s = DummySensor(
task_id="sensor",
mode="reschedule",
exponential_backoff=True,
)Task Log: attempt=1.log |
|
How can I request Reviewers? |
dirrao
left a comment
There was a problem hiding this comment.
Can you add the test case for the bug?
|
Thank you for the review, this is my first PR, I wanted some guidance on the testing. |
|
I looked into |
|
I have added a change, if it looks good |
|
I would also encourage authors and participants of PR #30669 to take a look as this approach doesn't involve DB column changes proposed in the above mentioned PR |
|
yes |
- added comment suggestion - revert earlier change
|
I feel this PR is ready for review along with tests. |
|
This one looks good. One thing to add is that you should add newsfragment describing the change (see |
Thanks for the review, I have added the necessary file. |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…Mode (apache#39823) * Fix: Increment try_number/poke_count in BaseSensorOperator for correct exponential backoff in reschedule mode. * exponential backoff handling for reschedule mode --------- Co-authored-by: sanket2000 <email@example.com>

Fix: Increment try_number/poke_count in BaseSensorOperator for correct exponential backoff in reschedule mode.
What happened?
BaseSensorOperatordoes not correctly implement exponential backoff when inreschedulemode.What you think should happen instead?
try_number(orpoke_count) should increment on each reschedule too, ensuring the backoff interval increases exponentially.How to reproduce?
BaseSensorOperatorwithmode="reschedule"andexponential_backoff=True.#6654
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.