diff --git a/rest/slurmrestapi.py b/rest/slurmrestapi.py index 68e89041..9eb1a0fd 100644 --- a/rest/slurmrestapi.py +++ b/rest/slurmrestapi.py @@ -140,8 +140,9 @@ def get_jobs(): @authentication_verify() def show_job(job_id): - # pyslurm >= 16.05 expects a string in parameter of job.find_id() - job = get_from_cache(pyslurm.job.find_id, 'show_job', str(job_id)) + # PySLURM >= 16.05 expects a string in parameter of job.find_id() and + # returns a list. The expected job dict is the 1st element of this list. + job = get_from_cache(pyslurm.job.find_id, 'show_job', str(job_id))[0] onlyUsersJobs = False fill_job_user(job) if auth_enabled: diff --git a/tests/mocks/pyslurm.py b/tests/mocks/pyslurm.py index 826006d3..129b663c 100644 --- a/tests/mocks/pyslurm.py +++ b/tests/mocks/pyslurm.py @@ -875,7 +875,7 @@ def get(self): def find_id(self, jobid): for job in context.CTLD.jobs: if job.jobid == jobid: - return job.todict()[jobid] + return [job.todict()[jobid]] return None class MockPySlurmReservation(object):