Browse Source

merged pass_worker_id_to_run_method into master

master
Tom Krüger 11 months ago
parent
commit
00ad1e2a10
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      alma/experiment.py

+ 5
- 3
alma/experiment.py View File

@ -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)


Loading…
Cancel
Save