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

JSONDecodeError with get_jobs method #159

Open
EnzoDelahaye opened this issue Oct 18, 2023 · 1 comment
Open

JSONDecodeError with get_jobs method #159

EnzoDelahaye opened this issue Oct 18, 2023 · 1 comment

Comments

@EnzoDelahaye
Copy link

EnzoDelahaye commented Oct 18, 2023

Hello,
I got an Exception with the Jobs.get_jobs method.
Here is the traceback:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/scheduler/scheduler.py", line 162, in get_running_crawls
    fetched_nomad_jobs = n.jobs.get_jobs(namespace="scrapy")
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/nomad/api/jobs.py", line 96, in get_jobs
    return self.request(method="get", params=params).json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I got many running jobs on Nomad, the method should return all jobs in the scrapy namespace.
Look like no any jobs are retrieved and empty string is passed to complexjson.loads(self.text, **kwargs)
I'm using python-nomad 2.0.0

@nikita-b
Copy link
Collaborator

Actually, it seems to be a bug with Nomad.... Which version of Nomad are you using?

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

No branches or pull requests

2 participants