Skip to content

[corner case] JSONDecodeError when requesting a job.summary() for an empty job ID #177

@juditnovak

Description

@juditnovak

First of all, thank you VERY much for the python-nomad library. I find it very useful working on an Open Source Airflow Nomad Provider

This is a complete corner case, I'm just reporting it for the record.

In case the job ID is an empty string for the job.summary() call, the following exception is raised:

.venv/lib/python3.13/site-packages/nomad/api/job.py:179: in get_summary
    return self.request(id_, "summary", method="get").json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[..]

E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

.venv/lib/python3.13/site-packages/requests/models.py:980: JSONDecodeError

I'm wondering that it may be nicer to return a descendant of BaseNomadException, or an empty return value (None/{})

(Also, if you like, I'm glad to offer the PR.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions