-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exponential Backoff Not Functioning in BaseSensorOperator Reschedule Mode #39823
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
BaseSensorOperator
does not correctly implement exponential backoff when inreschedule
mode.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?
BaseSensorOperator
withmode="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.rst
or{issue_number}.significant.rst
, in newsfragments.