-
Notifications
You must be signed in to change notification settings - Fork 3k
Replace Endpoints with Regional Endpoints #39390
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
Merged
kushagraThapar
merged 194 commits into
Azure:main
from
tvaron3:tvaron3/regionalEndpoints
Feb 5, 2025
Merged
Changes from all commits
Commits
Show all changes
194 commits
Select commit
Hold shift + click to select a range
b0fe9fd
add new policy, add logic to use policy
simorenoh 2444847
Merge branch 'main' into service_response_error_policy
simorenoh 83b7a0d
added small test file I was using
simorenoh 39d8a86
Merge branch 'service_response_error_policy' of https://github.com/si…
simorenoh 3e5b8e5
initial regional endpoint work
tvaron3 41eadb4
Merge branch 'service_response_error_policy' of https://github.com/si…
tvaron3 6df9e49
groundwork
tvaron3 c0f9d5f
re-add AzureError logic, refactor, fix tests
simorenoh 3eec9a1
Update _retry_utility.py
simorenoh cb7e8a8
Updated location_cache with new design
kushagraThapar 3ae5c3f
Fixed key error with most_preferred_location
kushagraThapar 116d8d3
Merge remote-tracking branch 'simon/service_response_error_policy' in…
kushagraThapar 8fd9f9d
Update test_cosmos_http_logging_policy.py
simorenoh 1305358
Update _retry_utility.py
simorenoh 0fbc20c
Added logic to refresh cache on previous endpoint usage
kushagraThapar 19e38c4
Added business logic update the regional endpoint based on success or…
kushagraThapar 2342d27
implementation
simorenoh cd010fa
Update _retry_utility_async.py
simorenoh 42ecabc
fix some tests
tvaron3 61f477b
changelog, versions, fixes
simorenoh 794cf18
fixes
simorenoh 1aff626
fix some tests
tvaron3 3ceffe0
remove fake logic, count fix
simorenoh 112538f
fix some tests
tvaron3 d7e8886
Update _service_request_retry_policy.py
simorenoh c13d28a
Update _retry_utility_async.py
simorenoh 7486d42
Merge with simon fix
tvaron3 ec3502c
retry utilities fixing
simorenoh 2828dda
Update _retry_utility.py
simorenoh 808d192
additional enhancements
simorenoh 8eca519
Update setup.py
simorenoh d49e1a4
Update _retry_utility_async.py
simorenoh 65bd86f
add tests, remove previous retry logic for ServiceRequestExceptions
simorenoh 291195a
clean up with finally
simorenoh e97f377
tests
simorenoh b2d1bb3
retry utilities
simorenoh 918785d
disable tests
simorenoh 863edc9
add logging to policies
simorenoh 07bc302
GetDatabaseAccount Fix
tvaron3 60851d6
Update _base.py
simorenoh e1f2ec3
retry utilities fixes
simorenoh 10fb752
Update _retry_utility.py
simorenoh 9f28e50
retry utulities part 34
simorenoh f4a7e0e
Update _service_request_retry_policy.py
simorenoh 62ce36c
remove extra logs
simorenoh d47d372
policy updates
simorenoh 0f9650a
Update _service_response_retry_policy.py
simorenoh 50385cd
Update _service_response_retry_policy.py
simorenoh a084a3a
policies updates and update operation types
simorenoh 43a229b
trying out fixes
simorenoh 93c2774
Update sdk/cosmos/azure-cosmos/CHANGELOG.md
simorenoh f07b81a
Update sdk/cosmos/azure-cosmos/CHANGELOG.md
simorenoh db83522
Skipped proxy test for debugging
kushagraThapar 852161b
annotation fix
simorenoh b95d61e
Merge branch 'service-reetries' of https://github.com/Azure/azure-sdk…
simorenoh 4534e51
Fixed some tests cases
kushagraThapar 8f8313a
test fixes
simorenoh 9243abb
Update test_service_retry_policies_async.py
simorenoh 552428a
Fixed some mocking behavior
kushagraThapar 7af122f
fixed pylint issues
kushagraThapar ac3743a
Added aiohttp minimum dependency
kushagraThapar c79df22
Updated changelog and setup.py
kushagraThapar 6ad9ca1
Updated changelog
kushagraThapar c61884f
Merge service-retries
tvaron3 62b9db5
Add changelog and fix tests.
tvaron3 1964565
Fix tests
tvaron3 a0c6abb
bootstrapping with global endpoint as previous for writes
tvaron3 887d5ef
merge with main
tvaron3 31482fa
Add headers and cleanup
tvaron3 610c399
cleanup and retry all service request headers
tvaron3 e7d7a97
Don't retry on a none previous
tvaron3 2390b0e
Updated the business logic with current and previous, fixed database …
kushagraThapar 58abeca
fix client id
tvaron3 736ddcf
Reacting to comments
tvaron3 a209eb8
Added print statements and fixed some retry logic
kushagraThapar 4f82f08
Revert getDatabase in mark endpoint
tvaron3 37f9bbb
Fixed some pylint and changelog issues
kushagraThapar 34607c6
Fixed version
kushagraThapar f7fd96f
fix bug with type check, update tests
simorenoh b0e210d
Update test_service_retry_policies_async.py
simorenoh 26f75d7
sync tests updates
simorenoh 9584ad3
Reacting to comments and fixing service request retry policy
tvaron3 67e0bca
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 1c3e9a5
Code review comments and pylint issues
kushagraThapar b5250cc
Fixed tests and pylint
kushagraThapar 8ea6b9f
more sync mock tests - missing async copies
simorenoh c3a9e99
Fixed min aiohttp requirements
kushagraThapar 353a7ae
Merged latest commit and resolved conflicts
kushagraThapar 41490ef
Merge branch 'main' into tvaron3/regionalEndpoints
kushagraThapar 0120ddd
Update _retry_utility_async.py
simorenoh 274e846
Change to check operation type in operations
tvaron3 f9e3a2a
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 8181d95
push initial GEM mock test
simorenoh 0d8d880
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 0758393
Update test_service_retry_policies.py
simorenoh 258c877
Fixed extra retries
tvaron3 77627e8
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 2c30d29
sync tests
simorenoh 319e5b2
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 2cb82be
Update test_service_retry_policies_async.py
simorenoh 3818885
Fixed extra retries and relevant tests
tvaron3 a711a3c
Only delay retry by one second
tvaron3 fa066ae
async tests - need to split up inheritance ones since endpoint unavai…
simorenoh 9b97295
Change retry strategy
tvaron3 9df935d
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 c928cd1
add sub-class errors tests
simorenoh 28b51ed
change old tests, refactoring, fix mocking bleed
simorenoh d4d93c0
Fix a test
tvaron3 f0266b2
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 fdfb171
clear last routed location pythonic
tvaron3 9b5d7a7
Removed aiohttp dependency
kushagraThapar d215e46
catch import errors
tvaron3 2cd1d4f
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 554d875
Skipped global endpoint manager test for debugging
kushagraThapar 9a351f0
Fixed tests
tvaron3 1ce1b08
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 0900806
Removed skips
tvaron3 f391fc4
fix live tests and print statements for debugging
tvaron3 e19b952
cleanup of few tests
kushagraThapar 9ec61e2
updated globaldb mock
kushagraThapar d4190f1
Moved some of the high offer throughput tests to live tests
kushagraThapar 25d5ac2
Fixed global endpoint retry async test
kushagraThapar ec7afdf
Tried fixing global endpoint retry async test
kushagraThapar f50a644
no swaps on success test
tvaron3 0c10812
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 d41a1ba
fix import
tvaron3 e71fa83
Tried fixing global endpoint retry async test
kushagraThapar 2313b8f
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 105a0eb
Added separate split live tests
kushagraThapar bc78060
Added live platform matrix
kushagraThapar 511167d
Merge branch 'tvaron3/regionalEndpoints' of github.com:tvaron3/azure-…
kushagraThapar 75f9b01
some test fixes
simorenoh d13beae
Fixed live test pipeline
kushagraThapar 209fd41
Moved test resource id to cosmosLong
kushagraThapar 7e5a2c3
Updated live tests
kushagraThapar 64cf837
Running live tests with proper flag
kushagraThapar 9a43071
testing logging experiments
kushagraThapar 6e92716
fix tests
simorenoh 929d47c
honor testmark argument through a safe environment variable, versus a…
scbedd ed89809
more test fixes
simorenoh f51384b
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 092eaf7
Merged latest commit and resolved conflicts
kushagraThapar db88f3b
remove accidental log files
simorenoh 539e9cd
Fixed issues with swapping and retry policies
kushagraThapar a232212
Merge branch 'testing_logging_experiments' into tvaron3/regionalEndpo…
kushagraThapar 6ee18f2
Merge changes
tvaron3 2a3d005
Merge branch 'testing_logging_experiments' of https://github.com/kush…
tvaron3 5b4159a
Fixed issues with swapping and retry policies
kushagraThapar 58f6163
Marking endpoint as down fix
tvaron3 1732af4
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 e016e86
more test fixes
simorenoh 91c08e4
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 4b9f276
Remove print statements
tvaron3 7d96364
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 01b5801
Fixed some minor issues with emulator tests
kushagraThapar 5df4e35
Merge branch 'tvaron3/regionalEndpoints' of github.com:tvaron3/azure-…
kushagraThapar b7ca3f0
split change feed tests
simorenoh d809d04
Fixed emulator tests
kushagraThapar 997df71
Merge branch 'tvaron3/regionalEndpoints' of github.com:tvaron3/azure-…
kushagraThapar d20cb8d
updated changelog
tvaron3 1f548ba
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 9c2ef11
Fixed emulator tests again
kushagraThapar 31fdef8
Fixed emulator tests and event loop
kushagraThapar 59f711c
vector/fts query tests
simorenoh 4ae78c3
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 15ebd45
Fix session token live tests
tvaron3 f17298b
hybrid search query fixes
simorenoh 989276b
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 5ca674d
Fixed live test name
kushagraThapar afe3102
fallback to regional
tvaron3 334a866
fix ci tests
tvaron3 a4f4714
Update conftest.py
simorenoh c73f699
Database accounts call will timeout in 5 seconds
tvaron3 1924b78
Merge with main
tvaron3 c0b41b8
Change timeouts and update docs
tvaron3 217bf4d
call updates to endpoint policy and location cache
simorenoh fde8d64
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
simorenoh 504bc6c
Health check for endpoitns
tvaron3 d78ef9d
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 9507321
database account retry policy
tvaron3 0421e91
Fix parameter error
tvaron3 e89bbe9
Retry on cosmos error fix
tvaron3 94d349b
Retry on service request error fix
tvaron3 c552653
None checks for request in retry utilities
tvaron3 f595650
lowercase constructed regional endpoint
tvaron3 af9a900
fix global endpoint as unhealthy
tvaron3 0f7fd42
fix parsing test
tvaron3 0579061
Added logic for swapping on health check failed
kushagraThapar 56c585f
Fixed log statement
kushagraThapar 7e0df0a
fix pylint, docs, and remove print statements
tvaron3 cc5d3da
Merge branch 'tvaron3/regionalEndpoints' of https://github.com/tvaron…
tvaron3 bdb491a
fix pylint
tvaron3 01575db
fix some tests
tvaron3 4582bd7
Prepared for release
kushagraThapar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
sdk/cosmos/azure-cosmos/azure/cosmos/_database_account_retry_policy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# The MIT License (MIT) | ||
# Copyright (c) 2014 Microsoft Corporation | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
"""Internal class for database account retry policy implementation in the | ||
Azure Cosmos database service. | ||
""" | ||
|
||
class DatabaseAccountRetryPolicy(object): | ||
"""The database account retry policy which should only retry once regardless of errors. | ||
""" | ||
|
||
def __init__(self, connection_policy): | ||
self.retry_count = 0 | ||
self.retry_after_in_milliseconds = 0 | ||
self.max_retry_attempt_count = 1 | ||
self.connection_policy = connection_policy | ||
|
||
def ShouldRetry(self, exception): # pylint: disable=unused-argument | ||
"""Returns true if the request should retry based on the passed-in exception. | ||
|
||
:param exceptions.CosmosHttpResponseError exception: | ||
:returns: a boolean stating whether the request should be retried | ||
:rtype: bool | ||
""" | ||
|
||
if self.retry_count >= self.max_retry_attempt_count: | ||
return False | ||
|
||
self.retry_count += 1 | ||
|
||
return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.