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

ResourceManager.cluster_submit_application fails with JSON error #76

Closed
kevin-bates opened this issue Jan 11, 2020 · 0 comments · Fixed by #77
Closed

ResourceManager.cluster_submit_application fails with JSON error #76

kevin-bates opened this issue Jan 11, 2020 · 0 comments · Fixed by #77

Comments

@kevin-bates
Copy link
Member

kevin-bates commented Jan 11, 2020

When using ResourceManager.cluster_submit_application() to submit a YARN application, the response is not properly handled and results in the following traceback...

  File "/opt/anaconda2/envs/py3/lib/python3.6/site-packages/yarn_api_client/resource_manager.py", line 397, in cluster_submit_application
    return self.request(path, 'POST', data=data)
  File "/opt/anaconda2/envs/py3/lib/python3.6/site-packages/yarn_api_client/base.py", line 84, in request
    return self.response_class(response)
  File "/opt/anaconda2/envs/py3/lib/python3.6/site-packages/yarn_api_client/base.py", line 23, in __init__
    self.data = response.json()
  File "/opt/anaconda2/envs/py3/lib/python3.6/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/anaconda2/envs/py3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/opt/anaconda2/envs/py3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/anaconda2/envs/py3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The issue appears to be related to responses that contain no content. In my opinion, this is a bug with response.json(), but we should probably handle this.

The request status code is the expected 202, but there is no "location" entry as described in the REST API. I see an empty response using other REST clients as well.

This was discovered while troubleshooting #75 and the python file included in that issue can be used to reproduce this.

This could very well be an issue with the Hadoop cluster I'm running against also. (HDP 2.7.3.2.6.5.0-292)

kevin-bates added a commit to kevin-bates/hadoop-yarn-api-python-client that referenced this issue Jan 11, 2020
Application submission via the REST API does not return a response
body.  This updates ensures that an empty dictionary is returned
in such cases.

Fixes: gateway-experiments#76
lresende pushed a commit that referenced this issue Jan 13, 2020
Application submission via the REST API does not return a response
body.  This updates ensures that an empty dictionary is returned
in such cases.

Fixes: #76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant