Ejemplo n.º 1
0
    def start(self):
        # Initialize the arbiter, create pidfile if needed.
        self.set_process_owner(self.uid, self.gid)

        # setup logging
        self.file_logger = setup_file_logging("prefork", self.log_file)
        self.file_logger.info("Startting arbiter")
        self.file_logger.info('Use Config File %s', self.config_file)

        if self.daemonize:
            daemonize()

        _setproctitle(self.master_name)
        self.pid = os.getpid()
        self.file_logger.info("Master Pid --> %s" % self.pid)
        try:
            if self.pidfile:
                self.pidfile.create(self.pid)
                # chown(self.pidfile.fname, self.uid, self.gid)
        except Exception, e:
            self.file_logger.info(str(e))
Ejemplo n.º 2
0
    def reload(self):
        self.file_logger.info("Reload config file:%s", self.cfg.ACTUAL_CONFIG_FILE)

        old_pidfile = self.pidfile
        self.cfg.load_config()
        self.setup()

        if old_pidfile and self.pidfile and old_pidfile.fname != self.pidfile.fname:
            #old_pidfile.unlink()
            self.file_logger.info("pidfile:%s", self.pidfile.fname)
            self.pidfile.rename(self.pid)

        self.set_process_owner(self.uid, self.gid)
        self.file_logger = setup_file_logging("prefork", self.log_file)
        _setproctitle(self.master_name)

        # start new workers
        for i in range(self.number_workers):
            self.spawn_worker()

        self.manage_workers()
Ejemplo n.º 3
0
    def start(self):
        # Initialize the arbiter, create pidfile if needed.
        self.set_process_owner(self.uid, self.gid)

        # setup logging
        self.file_logger = setup_file_logging("prefork", self.log_file)
        self.file_logger.info("Startting arbiter")
        self.file_logger.info('Use Config File %s', self.config_file)

        if self.daemonize:
            daemonize()

        _setproctitle(self.master_name)
        self.pid = os.getpid()
        self.file_logger.info("Master Pid --> %s"%self.pid)
        try:
            if self.pidfile:
                self.pidfile.create(self.pid)
                # chown(self.pidfile.fname, self.uid, self.gid)
        except Exception,e:
            self.file_logger.info(str(e))
Ejemplo n.º 4
0
 def __init__(self, cfg, file_logger=None, ppid=None, sockets=None):
     SyncWorker.__init__(self, cfg, file_logger, ppid)
     setup_file_logging(self.LOGGER_NAME, self.cfg.log_file)
     self.logger = logging.getLogger(self.LOGGER_NAME)
Ejemplo n.º 5
0
 def __init__(self, cfg, file_logger=None, ppid=None, sockets=None):
     SyncWorker.__init__(self, cfg, file_logger, ppid)
     setup_file_logging(self.LOGGER_NAME, self.cfg.log_file)
     self.logger = logging.getLogger(self.LOGGER_NAME)