Skip to content
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

feat: Add a simple backoff and retry utility helper #452

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

leongdl
Copy link
Contributor

@leongdl leongdl commented Sep 25, 2024

What was the problem/requirement? (What/Why)

  • We had to revert this PR because it added a new dependency.
  • Our goal is to minimize external 3rd party library dependencies in deadline-cloud's python lib.

What was the solution? (How)

  • Add a basic retry decorator to support use cases that need retry.

What is the impact of this change?

  • We can decorate @Retry now with exponential back off and retry

How was this change tested?

  • hatch build

  • hatch run all:lint

  • hatch run fmt

  • hatch run test

  • Have you run the unit tests?

  • Yes

  • Have you run the integration tests?

  • Not applicable.

  • Have you made changes to the download or asset_sync modules? If so, then it is highly recommended
    that you ensure that the docker-based unit tests pass.

  • Not applicable

Was this change documented?

Not applicable. New internal API function docs added.

Is this a breaking change?

No

Does this change impact security?

No


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@leongdl leongdl force-pushed the retry branch 2 times, most recently from cd3c3a8 to 84763d2 Compare September 25, 2024 01:43
@leongdl leongdl marked this pull request as ready for review September 25, 2024 01:48
@leongdl leongdl requested a review from a team as a code owner September 25, 2024 01:48
Comment on lines 108 to 110
tries: int = 4,
delay: Union[int, float, Tuple[Union[int, float], Union[int, float]]] = 3.0,
backoff: float = 2.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: these defaults would lead to very slow failure in the worst case. Would it make sense to tighten them up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can adjust them in a follow up (i have many PRs on going)

how about 1 retry, delay of 1s, back off 1s?

crowecawcaw
crowecawcaw previously approved these changes Sep 25, 2024
@leongdl leongdl enabled auto-merge (squash) September 26, 2024 17:47
Copy link

@leongdl leongdl merged commit 88a4ef6 into aws-deadline:mainline Sep 26, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants