Implement with_tasks option to expand the task information (#3343)

* Implement with_tasks option to expand the task information

* Added tests

* format
This commit is contained in:
Cheick Keita
2023-07-26 16:00:53 -07:00
committed by GitHub
parent fc4e698f9b
commit 8cb761a565
7 changed files with 88 additions and 22 deletions

View File

@ -1308,14 +1308,16 @@ class Jobs(Endpoint):
"DELETE", models.Job, data=requests.JobGet(job_id=job_id_expanded)
)
def get(self, job_id: UUID_EXPANSION) -> models.Job:
def get(self, job_id: UUID_EXPANSION, with_tasks: bool = False) -> models.Job:
"""Get information about a specific job"""
job_id_expanded = self._disambiguate_uuid(
"job_id", job_id, lambda: [str(x.job_id) for x in self.list()]
)
self.logger.debug("get job: %s", job_id_expanded)
job = self._req_model(
"GET", models.Job, data=requests.JobGet(job_id=job_id_expanded)
"GET",
models.Job,
data=requests.JobGet(job_id=job_id_expanded, with_tasks=with_tasks),
)
return job