def start(self, config: dict):
"""Start the arbiter worker process"""
with self.lock:
if self.arbiter and not self.arbiter_stop_flag.value:
msg = 'Failed to start. Arbiter process already running.'
raise ServiceException(msg)
if self.arbiter_process and self.arbiter_process.is_alive():
LOG.info('Arbiter process is still alive. Terminating...')
self.arbiter_process.terminate()
self.arbiter_stop_flag = Value('b', False)
self.config = Configuration().update(config)
self.arbiter = Arbiter(self.config)
self.arbiter_process = Process(target=self._loop,
args=(self.arbiter,
self.arbiter_stop_flag))
self.arbiter_process.daemon = True
self.arbiter_process.start()
self.start_time = time.time()
LOG.info('Arbiter process was started')
return True
评论列表
文章目录