diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-01-04 09:35:24 -0500 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2019-01-04 09:35:24 -0500 |
commit | be3fb1ace710399c0fbe1909f445d09028f2d307 (patch) | |
tree | 71f871948c256b9b3a5ebbd7464de7af083615dc /src/dashboard/tasks.py | |
parent | b3fd0140ac4096a37beab1b9ec135a178503f9c7 (diff) |
Fixed Query for free hosts
Change-Id: I05213a3521c5ffa6b311c9e11e9d593dd2098ebe
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/dashboard/tasks.py')
-rw-r--r-- | src/dashboard/tasks.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dashboard/tasks.py b/src/dashboard/tasks.py index 67a06fd..837e7a1 100644 --- a/src/dashboard/tasks.py +++ b/src/dashboard/tasks.py @@ -92,10 +92,14 @@ def free_hosts(): """ gets all hosts from the database that need to be freed and frees them """ - undone_jobs = Job.objects.filter(hostnetworkrelation__status__ne=200, hosthardwarerelation__status__ne=200) + undone_statuses = [JobStatus.NEW, JobStatus.CURRENT, JobStatus.ERROR] + undone_jobs = Job.objects.filter( + hostnetworkrelation__status__in=undone_statuses, + hosthardwarerelation__status__in=undone_statuses + ) bookings = Booking.objects.exclude( - job_in=undone_jobs + job__in=undone_jobs ).filter( end__lt=timezone.now(), job__complete=True, |