Adding 1 second sleep time between retries for publishing tasks#35791
Adding 1 second sleep time between retries for publishing tasks#35791sathish9094 wants to merge 2 commits intoapache:mainfrom
Conversation
|
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 Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
|
@hussein-awala Can you please help to review/approve this PR? |
|
I don't think hardcoding it to 1 second is a good idea. it sounds pretty magical. Also it has potentially undesireable side effects - there might be cases where the retry is actually good if it happens quickly. If we want to do add anything like that, I'd say we should have a configuration option telling whether to delay retries or not and how long. Also it is generally a bad idea to have a fixed hard-coded value - ideally there should be a way to get at least a bit of exponential back-off and make several retries with increasing delay period - and we should be able to configure both initlal delay, number of retries and exponential back-off factor. We can use tenacity for that - we already use it for similar purposes. I think if this is done this way - with configurable retries, exponential backoff (and unit tests as well) - then we could merge it I think. |
hussein-awala
left a comment
There was a problem hiding this comment.
I agree with @potiuk; the best solution is moving the retried block to a new method and applying a @tenacity.retry, and similar to task_publish_max_retries, we should add a configuration for wait time and strategy (fixed or exponential).
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
This retry loop is pretty fast and it doesn't wait for number of seconds value that we pass from airflow.cfg
By making it to wait for a second before each retry will give some time for broker recovery before making the task as failed.