Exemplo n.º 1
0
 def create_actor(self):
     if self.cfg.daemon:
         if not self.cfg.pidfile:
             self.cfg.set('pidfile', 'pulsar.pid')
         system.daemonize(keep_fds=logger_fds())
     self.aid = self.name
     actor = super().create_actor()
     self.monitors = OrderedDict()
     self.registered = {self.identity(actor): actor}
     actor.bind_event('start', self._start_arbiter)
     return actor
Exemplo n.º 2
0
 def before_start(self, actor):  # pragma    nocover
     '''Daemonise the system if required.
     '''
     cfg = actor.cfg
     if cfg.reload:
         if autoreload.start():
             return
     if cfg.daemon:
         system.daemonize(keep_fds=logger_fds())
         actor.logger.info('Successfully daemonized process')
         if not cfg.pidfile:
             pidfile = 'pulsar.pid'
             actor.logger.info('Setting pid file to %s', pidfile)
             cfg.set('pidfile', pidfile)
     actor.start_coverage()
     self._install_signals(actor)
Exemplo n.º 3
0
 def create_actor(self):
     cfg = self.cfg
     policy = EventLoopPolicy(cfg.event_loop, cfg.thread_workers,
                              cfg.debug)
     asyncio.set_event_loop_policy(policy)
     if cfg.daemon:     # pragma    nocover
         # Daemonize the system
         if not cfg.pid_file:
             cfg.set('pid_file', 'pulsar.pid')
         system.daemonize(keep_fds=logger_fds())
     self.aid = self.name
     actor = super().create_actor()
     self.monitors = OrderedDict()
     self.registered = {self.identity(actor): actor}
     actor.bind_event('start', self._start_arbiter)
     return actor