diff --git a/al2/experiment.py b/al2/experiment.py index f25d355..be1a5ab 100644 --- a/al2/experiment.py +++ b/al2/experiment.py @@ -43,6 +43,8 @@ class Dispatcher (threading.Thread): self.__workers = [] self.__stop_called = threading.Event() + self.__exp_mod = exp_mod + for i in range(self.__num_workers): self.__workers.append(Worker(exp_mod, exp_plan)) @@ -72,6 +74,8 @@ class Dispatcher (threading.Thread): for worker in self.__workers: worker.join() + self.__done() + def stop(self): self.__stop_called.set() @@ -82,6 +86,11 @@ class Dispatcher (threading.Thread): return count + def __done(self): + if hasattr(self.__exp_mod, "done"): + self.__exp_mod.done() + + class Worker (multiprocessing.Process): def __init__(self, exp_mod, exp_plan): multiprocessing.Process.__init__(self)