Skip to content

Commit

Permalink
SDK-386: Increase number of default retries for HTTP Requests (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekharsaurabh authored and chattarajoy committed Apr 22, 2020
1 parent 8bf79f9 commit e10933e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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()

0 comments on commit e10933e

Please sign in to comment.