Exemplo n.º 1
0
  def __init__(self, name, role):
    """
    """

    OverlayService.__init__(self, name, AlluxioService.DEFAULT_PORT)
    self.connection = None
    self._role = role
Exemplo n.º 2
0
  def __init__(self, name, port=6379, **kwargs):
    """
    """
    config = systemsettings()
    if not config.configured():
      # For now assume JSON file
      config.applyConfig(name + '.json')

    self.workdir             = config.WORKDIR  #ini.get('workdir', '.')
    self.redis_conf_template =  config.REDIS_CONF_TEMPLATE #init.get('redis_conf_template', 'templates/redis.conf.temp')
    self.MONITOR_WAIT_DELAY    = config.MONITOR_WAIT_DELAY #ini.get('monitor_wait_delay', 30)
    self.CATALOG_IDLE_THETA    = config.CATALOG_IDLE_THETA #ini.get('catalog_idle_theta', 300)
    self.CATALOG_STARTUP_DELAY = config.CATALOG_STARTUP_DELAY #ini.get('catalog_startup_delay', 10)

    port = config.CATALOG_PORT

    OverlayService.__init__(self, name, port, **kwargs)
    self.connection = None


    # Check if a connection exists to do an immediate shutdown request
    # if os.path.exists(self.lockfile):
    #   host, port, state = self.getconnection()
    #   self.shutdowncmd = 'redis-cli -h %s -p %s shutdown' % (host, port)

    # FOR IDLE REPORTING Using Command Count
    self.ping_count = 0
    self.last_cmd_count = 0
    self.last_cmd_ts = dt.now()
    self.total_idle_time = 0.
    self.current_idle_time = 0.

    # FOR IDLE REPORTING and Metric Recording
    self.persist = True
    self.idle_report = 0
    self.idle_actual = 0
    self.IDLE_REPORT_THETA = 60   # we will consider the service "idle" if it receives no request for 1 min

    # The Command monitor to track idle time
    self.cmd_mon = None
    self.cmd_mon_pid = None


    # External Logger to track metrics:
    logfile = os.path.join(os.environ['HOME'], 'ddc', 'results', 'redismon_%s.log'%name)
    self.monlog = logging.getLogger('redis_mon_%s'%name)
    self.monlog.setLevel(logging.INFO)
    fh = logging.FileHandler(logfile)
    fh.setLevel(logging.INFO)
    fmt = logging.Formatter('%(message)s')
    fh.setFormatter(fmt)
    self.monlog.addHandler(fh)
    self.monlog.propagate = False
Exemplo n.º 3
0
    def __init__(self, name, port=6379, **kwargs):
        """
    """
        config = systemsettings()
        if not config.configured():
            # For now assume JSON file
            config.applyConfig(name + '.json')

        self.workdir = config.WORKDIR  #ini.get('workdir', '.')
        self.redis_conf_template = config.REDIS_CONF_TEMPLATE  #init.get('redis_conf_template', 'templates/redis.conf.temp')
        self.MONITOR_WAIT_DELAY = config.MONITOR_WAIT_DELAY  #ini.get('monitor_wait_delay', 30)
        self.CATALOG_IDLE_THETA = config.CATALOG_IDLE_THETA  #ini.get('catalog_idle_theta', 300)
        self.CATALOG_STARTUP_DELAY = config.CATALOG_STARTUP_DELAY  #ini.get('catalog_startup_delay', 10)

        port = config.CATALOG_PORT

        OverlayService.__init__(self, name, port, **kwargs)
        self.connection = None

        # Check if a connection exists to do an immediate shutdown request
        # if os.path.exists(self.lockfile):
        #   host, port, state = self.getconnection()
        #   self.shutdowncmd = 'redis-cli -h %s -p %s shutdown' % (host, port)

        # FOR IDLE REPORTING Using Command Count
        self.ping_count = 0
        self.last_cmd_count = 0
        self.last_cmd_ts = dt.now()
        self.total_idle_time = 0.
        self.current_idle_time = 0.

        # FOR IDLE REPORTING and Metric Recording
        self.persist = True
        self.idle_report = 0
        self.idle_actual = 0
        self.IDLE_REPORT_THETA = 60  # we will consider the service "idle" if it receives no request for 1 min

        # The Command monitor to track idle time
        self.cmd_mon = None
        self.cmd_mon_pid = None

        # External Logger to track metrics:
        logfile = os.path.join(os.environ['HOME'], 'ddc', 'results',
                               'redismon_%s.log' % name)
        self.monlog = logging.getLogger('redis_mon_%s' % name)
        self.monlog.setLevel(logging.INFO)
        fh = logging.FileHandler(logfile)
        fh.setLevel(logging.INFO)
        fmt = logging.Formatter('%(message)s')
        fh.setFormatter(fmt)
        self.monlog.addHandler(fh)
        self.monlog.propagate = False