-
Notifications
You must be signed in to change notification settings - Fork 11
retries for examples #72
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
retries for examples #72
Conversation
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.
Pull request overview
This pull request enhances the reliability of Dataverse SDK example scripts by introducing comprehensive retry and backoff logic to handle transient errors and eventual consistency delays in the Dataverse environment.
Key Changes:
- Added
backoffhelper function to automatically retry API calls on transient HTTP errors with configurable delays - Introduced metadata polling functions (
wait_for_table_metadata,wait_for_attribute_visibility) to handle eventual consistency issues - Wrapped all major Dataverse operations (create, update, delete, query) with retry logic across example scripts
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/PowerPlatform/Dataverse/data/_odata.py |
Enhanced retry logic in _optionset_map method with configurable max attempts and exponential backoff for metadata fetch operations |
examples/basic/functional_testing.py |
Added wait_for_table_metadata polling function and retry logic for all CRUD operations, plus improved cleanup with retry handling |
examples/advanced/walkthrough.py |
Introduced backoff helper function and wrapped all API calls with retry logic for improved resilience |
examples/advanced/file_upload.py |
Added wait_for_attribute_visibility function and applied retry logic to file operations and metadata queries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tested all examples that they can succeed 3 runs in a row without errors outside of retries
Copilot summary:
This pull request introduces robust retry and backoff logic to the advanced and basic example scripts, improving their reliability when interacting with Dataverse APIs, especially in the face of transient errors or eventual consistency delays. The changes primarily involve wrapping API calls with a
backoffhelper, adding custom backoff delays for attribute visibility, and enhancing metadata polling. These updates make the scripts more resilient to temporary failures and slow propagation of changes in the Dataverse environment.Enhanced retry and backoff handling:
Introduced a
backofffunction in bothfile_upload.pyandwalkthrough.pyto automatically retry API calls on transient errors, using configurable delay intervals and HTTP status codes. All major Dataverse operations (create, update, delete, query, etc.) are now wrapped with this retry logic to handle temporary failures more gracefully. [1] [2]In
file_upload.py, addedATTRIBUTE_VISIBILITY_DELAYSand applied custom backoff delays when polling for attribute visibility and during attribute creation, addressing eventual consistency issues in Dataverse metadata propagation. [1] [2] [3]Added a
wait_for_attribute_visibilityfunction infile_upload.pyto explicitly poll for new attribute availability before proceeding, further reducing errors caused by metadata not being immediately available.Improved metadata polling and reliability:
In
functional_testing.py, introduced await_for_table_metadatafunction to poll for table metadata availability after creation, replacing a fixed sleep with a more robust check for actual readiness. This reduces test flakiness due to eventual consistency in table creation. [1] [2]Updated
ensure_test_tableinfunctional_testing.pyto use the new metadata polling function, ensuring subsequent test steps only proceed when the table is fully available.General script robustness:
Minor improvements:
time,requests) where necessary to support new logic.functional_testing.py. [1] [2]