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 <>
1 job for 2020.02-collabora in 1 minute and 16 seconds (queued for 1 second)
Status Job ID Name Coverage
passed #79476
build debian source