diff options
author | Neil Williams <neil.williams@linaro.org> | 2018-09-11 09:09:58 +0100 |
---|---|---|
committer | Neil Williams <neil.williams@linaro.org> | 2018-09-14 08:49:10 +0100 |
commit | 6a2638fb6e0544077eb655391c7b7b927beeade1 (patch) | |
tree | 5ac975f658b1d68e4a1f0418a89cfb0bc768cbb8 | |
parent | c56ab4c667bd2a1394753c2e0970c6d301d0fd5f (diff) |
Handle cancelled test jobs in get_recent_jobs
Ensure get_recent_jobs_for_device_type can return data
if job.actual_device has not been assigned, e.g. whilst
in Submitted.
Move the hostname check inside the loop
Signed-off-by: Neil Williams <neil.williams@linaro.org>
-rw-r--r-- | lava_scheduler_app/api/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lava_scheduler_app/api/__init__.py b/lava_scheduler_app/api/__init__.py index 91ca39257..63ec88f56 100644 --- a/lava_scheduler_app/api/__init__.py +++ b/lava_scheduler_app/api/__init__.py @@ -442,11 +442,14 @@ class SchedulerAPI(ExposedAPI): job_qs = job_qs.filter(submitter=self.user) job_list = [] for job in job_qs.all()[:count]: + hostname = '' + if job.actual_device: + hostname = job.actual_device.hostname job_dict = { "id": job.id, "description": job.description, "status": job.get_legacy_status_display(), - "device": job.actual_device.hostname, + "device": hostname, } if not job.can_view(self.user): job_dict["id"] = None |