Add support for starting and stopping a job queue

This commit is contained in:
Roberto Rosario
2012-08-01 16:07:56 -04:00
parent 198a2908d2
commit 7b5a64f434
12 changed files with 207 additions and 42 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ from clustering.models import Node
from .models import JobQueue
from .exceptions import JobQueueNoPendingJobs
from .literals import JOB_QUEUE_STATE_STARTED
LOCK_EXPIRE = 10
MAX_CPU_LOAD = 90.0
@@ -30,7 +31,7 @@ def job_queue_poll():
lock.release()
raise
else:
for job_queue in JobQueue.objects.all():
for job_queue in JobQueue.objects.filter(state=JOB_QUEUE_STATE_STARTED):
try:
job_item = job_queue.get_oldest_pending_job()
job_item.run()