コード例 #1
0
    def __init__(self):
        super(StateUpdater, self).__init__()

        # flag the thread as daemon so it's abruptly killed
        # when its parent process exists
        self.daemon = True

        # shared memory client
        self.sm = sharedmem.MemcacheClient(
            [config.BASE['SHARED_MEM_HOSTNAME']],
            socket_timeout=config.BASE['SHARED_MEM_SOCKET_TIMEOUT'])
コード例 #2
0
ファイル: __init__.py プロジェクト: dungtran211096/DNS
    def __init__(self):
        self._procs_started = None
        self._control_socket = None

        # multiprocessing.Process() objects of the child processes spawned
        self._processes = []

        # shared memory client
        self._sm = sharedmem.MemcacheClient(
            [config.BASE['SHARED_MEM_HOSTNAME']],
            socket_timeout=config.BASE['SHARED_MEM_SOCKET_TIMEOUT'],
            server_max_value_length=config.BASE['SHARED_MEM_SERVER_MAX_VALUE_LENGTH'])
コード例 #3
0
    def __init__(self):
        super(StatePusher, self).__init__()

        # flag the thread as daemon so it's abruptly killed
        # when its parent process exists
        self.daemon = True

        # shared memory client
        self.sm = sharedmem.MemcacheClient(
            [config.BASE['SHARED_MEM_HOSTNAME']],
            socket_timeout=config.BASE['SHARED_MEM_SOCKET_TIMEOUT'],
            server_max_value_length=config.BASE['SHARED_MEM_SERVER_MAX_VALUE_LENGTH'])

        # on startup do not attempt to push state
        self.state_ts = 0
コード例 #4
0
ファイル: polaris.py プロジェクト: opshu/polaris-gslb
    def __init__(self):
        super(Polaris, self).__init__()

        # shared memory client
        self._sm = sharedmem.MemcacheClient(
            [config.BASE['SHARED_MEM_HOSTNAME']],
            socket_timeout=config.BASE['SHARED_MEM_SOCKET_TIMEOUT'])

        # this will hold the distribution state
        self._state = {}

        # used to determine whether we need to set self._state
        # to the state we pull from shared memory(every STATE_SYNC_INTERVAL)
        # initialize with 0 as it will be used for comparison
        # in self._sync_state on it's first run
        self._state_timestamp = 0

        # time when the state was last synced from shared memory
        # init with 0 for comparison in _sync_state() to work
        self._state_last_synced = 0
コード例 #5
0
ファイル: __init__.py プロジェクト: opshu/polaris-gslb
    def __init__(self, prober_requests, prober_responses):
        """
        args:
            prober_requests: multiprocessing.Queue(), 
                queue to put new probes on
            prober_responses: multiprocessing.Queue(),
                queue to get processed probes from
        """
        super(Tracker, self).__init__()

        self.prober_requests = prober_requests
        self.prober_responses = prober_responses

        # create health state table from the lb config
        self.state = state.State(config_obj=config.LB)

        # shared memory client
        self._sm = sharedmem.MemcacheClient(
            [config.BASE['SHARED_MEM_HOSTNAME']],
            socket_timeout=config.BASE['SHARED_MEM_SOCKET_TIMEOUT'],
            server_max_value_length=config.
            BASE['SHARED_MEM_SERVER_MAX_VALUE_LENGTH'])