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

[Cosmos] Reconfigure retry policy #7544

Merged

Conversation

annatisch
Copy link
Member

Adding support for connection retry as a Pipeline policy rather than adding a urllib Retry object to the session.
Should be 99% backwards compatible.
Tests will require this fix for azure-core in order to pass: PR #7542

@annatisch annatisch added Cosmos Client This issue points to a problem in the data-plane of the library. labels Oct 1, 2019
@annatisch annatisch requested a review from shurd as a code owner October 1, 2019 21:38
@adxsdk6
Copy link

adxsdk6 commented Oct 1, 2019

Can one of the admins verify this patch?

@bryevdv
Copy link
Contributor

bryevdv commented Oct 1, 2019

one small comment, LGTM

@annatisch annatisch requested a review from xiangyan99 as a code owner October 2, 2019 23:47
@annatisch
Copy link
Member Author

Ping @johanste, @srinathnarayanan :)

@annatisch annatisch requested a review from johanste October 3, 2019 22:39
@@ -64,6 +67,8 @@ def Execute(client, global_endpoint_manager, function, *args, **kwargs):
)
while True:
try:
client_timeout = kwargs.get('timeout')
start_time = time.time()
Copy link
Member

Choose a reason for hiding this comment

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

Should this be outside the loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @johanste
I don't think so - we calculate the time spent for each loop iteration and deduct it from the absolute timeout, which we then feed back into kwargs on line 122 - so I think it's correct to do this with each iteration

@annatisch annatisch merged commit 962391c into Azure:feature/cosmos-preview4 Oct 4, 2019
annatisch added a commit that referenced this pull request Oct 9, 2019
* [Cosmos] Reconfigure retry policy (#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (#7656)

* [Cosmos] More docs cleanup (#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* [Cosmos] Live test updates (#7693)

* Live test fixes

* Emulator test fixes

* Emulator test fixes

* Fix urllib3 reference
YijunXieMS pushed a commit to YijunXieMS/azure-sdk-for-python that referenced this pull request Oct 9, 2019
* [Cosmos] Reconfigure retry policy (Azure#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (Azure#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (Azure#7656)

* [Cosmos] More docs cleanup (Azure#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* [Cosmos] Live test updates (Azure#7693)

* Live test fixes

* Emulator test fixes

* Emulator test fixes

* Fix urllib3 reference
annatisch pushed a commit that referenced this pull request Oct 11, 2019
* intiial commit for query piepline changes

* initial commit for offset and limit

* modified aggregate tests to check for top as well after bugfix

* Added support for distinct

* modified aggregate tests to run in mono repo

* fixed failing tests and bugs

* updated tests

* fixed hashing problem for distinct

* fixed bug in distinct queries

* replaced single quotes with double quotes

* re introduced hashing via sha1

* fixed bug in distinct for py3

* dummy commit

* dummy commit

* [Cosmos] Core pipeline integration (#6961)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* [Cosmos] Applying track 2 SDK guidelines (#7021)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* Renamed clients

* Updated with azure-core errors

* Fixed test warnings

* Updated config

* PR fixes

* Fixed init user import

* Fixed init clients

* Started revising constructors

* Test conn str constructor

* Update iterables with core paging

* Added context managers

* Reverted storage changes

* Updated constructor

* Mypy and Pylint

* Renamed all listing operations

* Some mypy fixes

* Cleaned up method signatures

* Fix pylint

* Propagate kwargs

* Fix pylint

* Some mypy fixes

* Updated readme and release notes

* Fix for passing in extra headers

* Reverted credentials

* Review feedback

* Fix pylint

* Fixed samples

* Updated docstrings

* Fixed whitespace and imports

* Some mypy fixes

* Mypy fixes

* Removed continuation token support

* Pylint fix

* Docs tweaks

* Updated continuation token

* Updated response header

* Added support for Urllib3 Connection retries

Made Offer extend object instead of dict

* [Cosmos] Bumped dependency (#7147)

* Bumped dependency

* Update reqs

* Misc fixes for Cosmos SDK  (#7157)

* Made offer extend object instead of dict

* added support for urllib3 connection retry

* [Cosmos] Reconfigure retry policy (#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (#7656)

* [Cosmos] More docs cleanup (#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* dummy commit

* reverted dummy commit

* fixed failing test

fixed lint errors

* fixed failing tests

* updated comment

* added **kwargs to _GetQueryPlanThroughGateway
annatisch added a commit that referenced this pull request Oct 31, 2019
*  Query pipeline changes and Offset/Limit/Distinct support (#6770)

* intiial commit for query piepline changes

* initial commit for offset and limit

* modified aggregate tests to check for top as well after bugfix

* Added support for distinct

* modified aggregate tests to run in mono repo

* fixed failing tests and bugs

* updated tests

* fixed hashing problem for distinct

* fixed bug in distinct queries

* replaced single quotes with double quotes

* re introduced hashing via sha1

* fixed bug in distinct for py3

* dummy commit

* dummy commit

* [Cosmos] Core pipeline integration (#6961)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* [Cosmos] Applying track 2 SDK guidelines (#7021)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* Renamed clients

* Updated with azure-core errors

* Fixed test warnings

* Updated config

* PR fixes

* Fixed init user import

* Fixed init clients

* Started revising constructors

* Test conn str constructor

* Update iterables with core paging

* Added context managers

* Reverted storage changes

* Updated constructor

* Mypy and Pylint

* Renamed all listing operations

* Some mypy fixes

* Cleaned up method signatures

* Fix pylint

* Propagate kwargs

* Fix pylint

* Some mypy fixes

* Updated readme and release notes

* Fix for passing in extra headers

* Reverted credentials

* Review feedback

* Fix pylint

* Fixed samples

* Updated docstrings

* Fixed whitespace and imports

* Some mypy fixes

* Mypy fixes

* Removed continuation token support

* Pylint fix

* Docs tweaks

* Updated continuation token

* Updated response header

* Added support for Urllib3 Connection retries

Made Offer extend object instead of dict

* [Cosmos] Bumped dependency (#7147)

* Bumped dependency

* Update reqs

* Misc fixes for Cosmos SDK  (#7157)

* Made offer extend object instead of dict

* added support for urllib3 connection retry

* [Cosmos] Reconfigure retry policy (#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (#7656)

* [Cosmos] More docs cleanup (#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* dummy commit

* reverted dummy commit

* fixed failing test

fixed lint errors

* fixed failing tests

* updated comment

* added **kwargs to _GetQueryPlanThroughGateway

* Move cosmos errors.py -> exceptions.py (#8226)

* errors.py -> exceptions.py

* add deprecated errors.py stub

* update changelog

* linter

* add reprs to common user-facing classes (#8241)

* add reprs to common user-facing classes

* typo class name

* disable errant linter objection

* [Cosmos] Live test fixes (#8245)

* Cosmos live test fixes

* Another test fix

* Update tests for old emulator

* Removed disabled tests

* [Cosmos] Updates to kwargs and docstrings (#8277)

* Made version file internal

* Updated kwargs

* Updated docstrings

* Updated access condition kwargs

* More docs cleanup

* Whitespace

* Removed URLs for now

* Fix samples merge

* Updated conditional param parsing

* Fixed type hint

* Removed samples init

* Added match condition validation tests

* fix Cosmos README 404s (#8304)

* fix Cosmos README 404s

* typo

* Typo
fengzhou-msft pushed a commit that referenced this pull request Nov 5, 2019
* [Cosmos] Reconfigure retry policy (#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (#7656)

* [Cosmos] More docs cleanup (#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* [Cosmos] Live test updates (#7693)

* Live test fixes

* Emulator test fixes

* Emulator test fixes

* Fix urllib3 reference
fengzhou-msft pushed a commit that referenced this pull request Nov 5, 2019
*  Query pipeline changes and Offset/Limit/Distinct support (#6770)

* intiial commit for query piepline changes

* initial commit for offset and limit

* modified aggregate tests to check for top as well after bugfix

* Added support for distinct

* modified aggregate tests to run in mono repo

* fixed failing tests and bugs

* updated tests

* fixed hashing problem for distinct

* fixed bug in distinct queries

* replaced single quotes with double quotes

* re introduced hashing via sha1

* fixed bug in distinct for py3

* dummy commit

* dummy commit

* [Cosmos] Core pipeline integration (#6961)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* [Cosmos] Applying track 2 SDK guidelines (#7021)

* Updated dependencies

* Added core pipeline

* Ignore test config

* Fixed indexes test

* Refactored request creation

* Fixed index test

* Added trace decorators

* Bumped version

* Updated policies

* Renamed request_options -> request_params

* Renamed clients

* Updated with azure-core errors

* Fixed test warnings

* Updated config

* PR fixes

* Fixed init user import

* Fixed init clients

* Started revising constructors

* Test conn str constructor

* Update iterables with core paging

* Added context managers

* Reverted storage changes

* Updated constructor

* Mypy and Pylint

* Renamed all listing operations

* Some mypy fixes

* Cleaned up method signatures

* Fix pylint

* Propagate kwargs

* Fix pylint

* Some mypy fixes

* Updated readme and release notes

* Fix for passing in extra headers

* Reverted credentials

* Review feedback

* Fix pylint

* Fixed samples

* Updated docstrings

* Fixed whitespace and imports

* Some mypy fixes

* Mypy fixes

* Removed continuation token support

* Pylint fix

* Docs tweaks

* Updated continuation token

* Updated response header

* Added support for Urllib3 Connection retries

Made Offer extend object instead of dict

* [Cosmos] Bumped dependency (#7147)

* Bumped dependency

* Update reqs

* Misc fixes for Cosmos SDK  (#7157)

* Made offer extend object instead of dict

* added support for urllib3 connection retry

* [Cosmos] Reconfigure retry policy (#7544)

* Reconfigure retry policy

* Review feedback

* Fix pylint

* Updated tests

* Support client-side timeout

* Updated timeout logic

* Renamed client error

* Updated tests

* Patch azure-core

Needed pending PR 7542

* Fixed status retry tests

* Using dev core

* [Cosmos] Docs updates (#7626)

* Updated sample refs

* Added release notes

* Remove old rst files

* Fixed kwarg formatting

* add sdk tools repo (#7656)

* [Cosmos] More docs cleanup (#7661)

* Removed old docs

* Bumped core version

* Removed submodule docs

* Fixed imports

* Pylint fix

* More docs updates

* Fixed docstring types

* Docstring formatting

* Updated snippet references

* Fixed exception docs

* More exception docstrings

* Review feedback

* dummy commit

* reverted dummy commit

* fixed failing test

fixed lint errors

* fixed failing tests

* updated comment

* added **kwargs to _GetQueryPlanThroughGateway

* Move cosmos errors.py -> exceptions.py (#8226)

* errors.py -> exceptions.py

* add deprecated errors.py stub

* update changelog

* linter

* add reprs to common user-facing classes (#8241)

* add reprs to common user-facing classes

* typo class name

* disable errant linter objection

* [Cosmos] Live test fixes (#8245)

* Cosmos live test fixes

* Another test fix

* Update tests for old emulator

* Removed disabled tests

* [Cosmos] Updates to kwargs and docstrings (#8277)

* Made version file internal

* Updated kwargs

* Updated docstrings

* Updated access condition kwargs

* More docs cleanup

* Whitespace

* Removed URLs for now

* Fix samples merge

* Updated conditional param parsing

* Fixed type hint

* Removed samples init

* Added match condition validation tests

* fix Cosmos README 404s (#8304)

* fix Cosmos README 404s

* typo

* Typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants