Commit f8a4adfa authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

jqueue: Read-only jobs don't need processor lock


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 4f580fef
......@@ -217,7 +217,12 @@ class _QueuedJob(object):
obj.writable = writable
obj.ops_iter = None
obj.cur_opctx = None
obj.processor_lock = threading.Lock()
# Read-only jobs are not processed and therefore don't need a lock
if writable:
obj.processor_lock = threading.Lock()
else:
obj.processor_lock = None
def __repr__(self):
status = ["%s.%s" % (self.__class__.__module__, self.__class__.__name__),
......@@ -1231,6 +1236,8 @@ class _JobQueueWorker(workerpool.BaseWorker):
@param job: the job to be processed
"""
assert job.writable, "Expected writable job"
# Ensure only one worker is active on a single job. If a job registers for
# a dependency job, and the other job notifies before the first worker is
# done, the job can end up in the tasklist more than once.
......
Markdown is supported
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