Skip to content

Commit 052c2f8

Browse files
author
abdul
committed
default timeout to 10 minutes
1 parent 7fb5ddc commit 052c2f8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

mbs_client/client.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
DEFAULT_ENGINE_URL = "http://localhost:8888"
1616

17+
DEFAULT_TIMEOUT = 10 * 60 # 10 minutes
18+
1719
###############################################################################
1820
class Status(object):
1921
RUNNING = "running"
@@ -31,17 +33,26 @@ class MBSClient(object):
3133
###########################################################################
3234
def __init__(self, api_url):
3335
self._api_url = api_url
36+
self._timeout = DEFAULT_TIMEOUT
3437

35-
38+
###########################################################################
3639
@property
3740
def api_url(self):
3841
return self._api_url
3942

40-
###########################################################################
4143
@api_url.setter
4244
def api_url(self, url):
4345
self._api_url = url
4446

47+
###########################################################################
48+
@property
49+
def timeout(self):
50+
return self._timeout
51+
52+
@timeout.setter
53+
def timeout(self, t):
54+
self._timeout = t
55+
4556
###########################################################################
4657
# CLIENT METHODS
4758
###########################################################################
@@ -81,7 +92,7 @@ def stop_command(self):
8192
###########################################################################
8293
def _execute_command(self, command, params=None, data=None, method=None):
8394
url = self._command_url(command, params=params)
84-
return fetch_url_json(url=url, method=method, data=data)
95+
return fetch_url_json(url=url, method=method, data=data, timeout=self.timeout)
8596

8697
###########################################################################
8798
def _command_url(self, command, params=None):

0 commit comments

Comments
 (0)