Commit 5bdce580 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

jqueue: Store context in job queue instead of worker pool

The job queue will need to access to configuration, which is provided
through the context object, to get a list of nodes.

Reviewed-by: iustinp
parent 15fd9fd5
......@@ -181,7 +181,7 @@ class _JobQueueWorker(workerpool.BaseWorker):
logging.debug("Worker %s processing job %s",
proc = mcpu.Processor(self.pool.context)
proc = mcpu.Processor(self.pool.queue.context)
queue = job.queue
......@@ -242,16 +242,17 @@ class _JobQueueWorker(workerpool.BaseWorker):
class _JobQueueWorkerPool(workerpool.WorkerPool):
def __init__(self, context):
def __init__(self, queue):
super(_JobQueueWorkerPool, self).__init__(JOBQUEUE_THREADS,
self.context = context
self.queue = queue
class JobQueue(object):
_RE_JOB_FILE = re.compile(r"^job-(%s)$" % constants.JOB_ID_TEMPLATE)
def __init__(self, context):
self.context = context
self._memcache = {}
self._my_hostname = utils.HostInfo().name
......@@ -306,7 +307,7 @@ class JobQueue(object):
" file")
# Setup worker pool
self._wpool = _JobQueueWorkerPool(context)
self._wpool = _JobQueueWorkerPool(self)
# We need to lock here because WorkerPool.AddTask() may start a job while
# we're still doing our work.
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