Skip to content

Commit

Permalink
Merge pull request #301 from irontable/develop
Browse files Browse the repository at this point in the history
add response timeouts for job submits and gets in Python client
  • Loading branch information
irontablee committed Jun 27, 2016
2 parents 71a4bf6 + c843882 commit efdd45b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions genie-client/src/main/python/pygenie/adapter/genie_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def get(self, job_id, path=None):
url = '{}/{}'.format(url, path.lstrip('/'))

try:
return call(method='get', url=url).json()
return call(method='get', url=url, timeout=10).json()
except GenieHTTPError as err:
if err.response.status_code == 404:
raise GenieJobNotFoundError("job not found at {}".format(url))
Expand Down Expand Up @@ -261,7 +261,7 @@ def kill_job(self, job_id=None, kill_uri=None):
url = kill_uri if kill_uri is not None else self.__url_for_job(job_id)

try:
return call(method='delete', url=url)
return call(method='delete', url=url, timeout=10)
except GenieHTTPError as err:
if err.response.status_code == 404:
raise GenieJobNotFoundError("job not found at {}".format(url))
Expand All @@ -288,6 +288,7 @@ def submit_job(self, job):
separators=(',', ': ')))
call(method='post',
url='{}/{}'.format(job.conf.genie.url, Genie2Adapter.JOBS_ENDPOINT),
timeout=30,
data=json.dumps(payload),
headers=JSON_HEADERS)

Expand Down
7 changes: 6 additions & 1 deletion genie-client/src/main/python/pygenie/adapter/genie_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def get(self, job_id, path=None, if_not_found=None):
try:
return call(method='get',
url=url,
timeout=60,
auth_handler=self.auth_handler).json()
except GenieHTTPError as err:
if err.response.status_code == 404:
Expand Down Expand Up @@ -290,7 +291,10 @@ def kill_job(self, job_id=None, kill_uri=None):
url = kill_uri if kill_uri is not None else self.__url_for_job(job_id)

try:
return call(method='delete',url=url, auth_handler=self.auth_handler)
return call(method='delete',
url=url,
timeout=10,
auth_handler=self.auth_handler)
except GenieHTTPError as err:
if err.response.status_code == 404:
raise GenieJobNotFoundError("job not found at {}".format(url))
Expand Down Expand Up @@ -325,6 +329,7 @@ def submit_job(self, job):
call(method='post',
url='{}/{}'.format(job.conf.genie.url, Genie3Adapter.JOBS_ENDPOINT),
files=files,
timeout=300,
auth_handler=self.auth_handler)


Expand Down
2 changes: 1 addition & 1 deletion genie-client/src/main/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name='nflx-genie-client',
version='3.0.9',
version='3.0.10',
author='Netflix Inc.',
author_email='genieoss@googlegroups.com',
keywords='genie hadoop cloud netflix client bigdata presto',
Expand Down

0 comments on commit efdd45b

Please sign in to comment.