def _start_arbiter(self, actor, exc=None): if current_process().daemon: raise HaltServer('Cannot create the arbiter in a daemon process') if not os.environ.get('SERVER_SOFTWARE'): os.environ["SERVER_SOFTWARE"] = pulsar.SERVER_SOFTWARE pid_file = actor.cfg.pid_file if pid_file is not None: actor.logger.info('Create pid file %s', pid_file) try: p = Pidfile(pid_file) p.create(actor.pid) except RuntimeError as e: raise HaltServer('ERROR. %s' % str(e), exit_code=2) self.pid_file = p
def start_arbiter(self): if current_process().daemon: raise pulsar.PulsarException( 'Cannot create the arbiter in a daemon process') os.environ["SERVER_SOFTWARE"] = pulsar.SERVER_SOFTWARE pidfile = self.cfg.pidfile if pidfile is not None: try: p = Pidfile(pidfile) p.create(self.pid) except RuntimeError as e: raise HaltServer('ERROR. %s' % str(e), exit_code=3) self.pidfile = p return self
def _exit(self, exit_code): raise HaltServer(exit_code=exit_code)
def _register(self, arbiter): raise HaltServer('Critical error')
def done(self, exit_code=None): exit_code = exit_code or 0 if exit_code < 3: raise HaltServer(exit_code=exit_code)