merged pass_worker_id_to_run_method into master
This commit is contained in:
@@ -46,7 +46,7 @@ class Dispatcher (threading.Thread):
|
||||
self.__exp_mod = exp_mod
|
||||
|
||||
for i in range(self.__num_workers):
|
||||
self.__workers.append(Worker(exp_mod, exp_plan))
|
||||
self.__workers.append(Worker(exp_mod, exp_plan, i))
|
||||
|
||||
def run(self):
|
||||
for worker in self.__workers:
|
||||
@@ -93,11 +93,12 @@ class Dispatcher (threading.Thread):
|
||||
|
||||
|
||||
class Worker (multiprocessing.Process):
|
||||
def __init__(self, exp_mod, exp_plan):
|
||||
def __init__(self, exp_mod, exp_plan, id):
|
||||
multiprocessing.Process.__init__(self)
|
||||
|
||||
self.__exp_mod = exp_mod
|
||||
self.__exp_plan = exp_plan
|
||||
self.__id = id
|
||||
|
||||
def run(self):
|
||||
instance = self.__exp_plan.next()
|
||||
@@ -110,7 +111,8 @@ class Worker (multiprocessing.Process):
|
||||
instance,
|
||||
data
|
||||
),
|
||||
instance_state)
|
||||
instance_state,
|
||||
worker_id=self.__id)
|
||||
|
||||
self.__exp_plan.done_with(instance)
|
||||
|
||||
|
Reference in New Issue
Block a user