From 8328c31770117de4e25cf8fe9486c1d5ff6223da Mon Sep 17 00:00:00 2001 From: Saurabh Shekher Date: Fri, 17 Apr 2020 11:05:25 +0530 Subject: [PATCH 1/2] added required changes --- bin/qds.py | 4 ++-- qds_sdk/connection.py | 4 ++-- qds_sdk/qubole.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/qds.py b/bin/qds.py index 7f015f98..ea8deb3e 100755 --- a/bin/qds.py +++ b/bin/qds.py @@ -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, @@ -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 diff --git a/qds_sdk/connection.py b/qds_sdk/connection.py index 3cdb4a88..324c27f5 100644 --- a/qds_sdk/connection.py +++ b/qds_sdk/connection.py @@ -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 @@ -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): diff --git a/qds_sdk/qubole.py b/qds_sdk/qubole.py index cf87a681..659516af 100644 --- a/qds_sdk/qubole.py +++ b/qds_sdk/qubole.py @@ -21,7 +21,7 @@ class Qubole: """ MIN_POLL_INTERVAL = 1 - RETRIES_CAP = 5 + RETRIES_CAP = 7 MAX_RETRY_DELAY = 10 _auth = None @@ -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: From 20c530b6511638fcd7366f6a1e2493c22a894f2d Mon Sep 17 00:00:00 2001 From: Saurabh Shekher Date: Tue, 21 Apr 2020 10:58:48 +0530 Subject: [PATCH 2/2] test fix --- tests/test_connection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index ae7486a1..4be80912 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -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): @@ -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()