Commit f5afadbc authored by Guillaume Tucker's avatar Guillaume Tucker
Browse files

Only try to get current job when device is running in all_devices()

For some reason yet unknown, calling `.current_job()` on a Device
object when its state is not "running" can cause some server errors.
This is likely to be due to some discrepancy in the database.  The
schedule.all_devices() XMLRPC call causes an HTTP502 when this
happens.  Work around this problem by only looking for the current job
of devices that are in the running state.

Signed-off-by: Guillaume Tucker's avatarGuillaume Tucker <>
parent 11d19aed
......@@ -310,15 +310,20 @@ class SchedulerAPI(ExposedV2API):
devices_jobs = ((
dev.current_job() if dev.state == Device.STATE_RUNNING else None
) for dev in devices_list)
return [
dev.current_job().pk if dev.current_job() else None, if job else None,
for dev in devices_list
for dev, job in devices_jobs
def all_device_types(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment