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

fix:dev:SDK-386:Updating number of retries #317

Merged
merged 2 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/qds.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def main():
type=int,
default=os.getenv('QDS_MAX_RETRIES'),
help="Number of re-attempts for an api-call in case of "
" retryable exceptions. Defaults to 6.")
" retryable exceptions. Defaults to 7.")

optparser.add_option("-v", dest="verbose", action="store_true",
default=False,
Expand Down Expand Up @@ -634,7 +634,7 @@ def main():
options.poll_interval = 5

if options.max_retries is None:
options.max_retries = 6
options.max_retries = 7

if options.base_retry_delay is None:
options.base_retry_delay = 10
Expand Down
4 changes: 2 additions & 2 deletions qds_sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def init_poolmanager(self, connections, maxsize,block=False):
class Connection:

def __init__(self, auth, rest_url, skip_ssl_cert_check,
reuse=True, max_retries=6,
reuse=True, max_retries=7,
base_retry_delay=10):
self.auth = auth
self.rest_url = rest_url
Expand All @@ -55,7 +55,7 @@ def __init__(self, auth, rest_url, skip_ssl_cert_check,
self.session_with_retries = requests.Session()
self.session_with_retries.mount('https://', RequestAdapter(max_retries=3))

def retry(ExceptionToCheck, tries=6, delay=10, backoff=2):
def retry(ExceptionToCheck, tries=7, delay=10, backoff=2):
def deco_retry(f):
@wraps(f)
def f_retry(self, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions qds_sdk/qubole.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Qubole:
"""

MIN_POLL_INTERVAL = 1
RETRIES_CAP = 5
RETRIES_CAP = 7
MAX_RETRY_DELAY = 10

_auth = None
Expand All @@ -40,7 +40,7 @@ class Qubole:
def configure(cls, api_token,
api_url="https://api.qubole.com/api/", version="v1.2",
poll_interval=5, skip_ssl_cert_check=False, cloud_name="AWS",
base_retry_delay=10, max_retries=6):
base_retry_delay=10, max_retries=7):
"""
Set parameters governing interaction with QDS
Args:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_connection_override(self):
Connection.__init__ = Mock(return_value=None)
Connection._api_call = Mock(return_value={})
qds.main()
Connection.__init__.assert_called_with(ANY, ANY, ANY, ANY, 5, 10)
Connection.__init__.assert_called_with(ANY, ANY, ANY, ANY, 7, 10)

#Test with no values given should set default
def test_connection_default(self):
Expand All @@ -42,7 +42,7 @@ def test_connection_default(self):
Connection.__init__ = Mock(return_value=None)
Connection._api_call = Mock(return_value={})
qds.main()
Connection.__init__.assert_called_with(ANY, ANY, ANY, ANY, 5, 10)
Connection.__init__.assert_called_with(ANY, ANY, ANY, ANY, 7, 10)

if __name__ == '__main__':
unittest.main()