Use shorter, more tolerant work queue

This commit is contained in:
Steven Robertson 2012-03-16 20:34:34 -07:00
parent 0384815c8b
commit 89581b1a5a

View File

@ -23,7 +23,7 @@ pycuda = None
# The default maximum number of waiting jobs. Also used to determine when a # The default maximum number of waiting jobs. Also used to determine when a
# job has expired. # job has expired.
QUEUE_LENGTH=50 QUEUE_LENGTH=10
def partition(pred, arg): def partition(pred, arg):
return filter(pred, arg), filter(lambda a: not pred(a), arg) return filter(pred, arg), filter(lambda a: not pred(a), arg)
@ -212,7 +212,7 @@ def run_jobs(r, rev, jobs):
pending.pop(sidx) pending.pop(sidx)
else: else:
print 'Got two responses for %d' % sidx print 'Got two responses for %d' % sidx
if retry and retry[0] < sidx - 2 * QUEUE_LENGTH: if retry and retry[0] < sidx - 4 * QUEUE_LENGTH:
# TODO: ensure that this doesn't happen accidentally; raise an # TODO: ensure that this doesn't happen accidentally; raise an
# appropriate exception when it does # appropriate exception when it does
print "Double retry!" print "Double retry!"