def __init__(self, partitioner, logger=DummyUtil.dummy_logger(), delay=TimeSleepObj.ONE_TENTH_SECOND, timeout=-1): super().__init__() self._partitioner = partitioner self._timeout = timeout self._delay = delay self._logger = logger
def __init__(self, connection_str, logger=DummyUtil.dummy_logger()): super().__init__() self._logger = logger self._connection_str = connection_str self._connection = pika.BlockingConnection( pika.URLParameters(connection_str)) self._channel = self._connection.channel() tmp_result = self._channel.queue_declare(queue='', exclusive=True) self._tmp_queue_name = tmp_result.method.queue self._topic_names_to_types = {} self._op = None
def __init__(self, service_name, rpc_storage=None): Base.__init__(self) self._logger = DummyUtil.dummy_logger() self._service_name = service_name if rpc_storage: assert rpc_storage.get_storage_type() == StorageType.PARTITIONER_STORAGE if 'ttl' not in rpc_storage.get_dir_name(): self._SYS_LOGGER.warning("Warning. Please ttl the request log table.") underlying_storage = ProtoTableStorage() rpc_storage.set_underlying_storage(storage=underlying_storage) rpc_storage.set_max_capacity(max_capacity=EnvUtil.get_pslx_env_variable('PSLX_INTERNAL_CACHE')) self._rpc_storage = rpc_storage self._request_timestamp = collections.deque() self._request_response_pair = {}
def __init__(self, ws_url, params, logger=DummyUtil.dummy_logger()): super().__init__() self._ws_url = ws_url self._params = params self._logger = logger self._ws_connection = None self._op = None try: self._loop = asyncio.get_event_loop() except Exception as err: self._logger.warning("Getting the loop with error: " + str(err) + '.') self._loop = asyncio.new_event_loop() asyncio.set_event_loop(self._loop)
def __init__(self, container_name, logger=DummyUtil.dummy_logger()): super().__init__() self._container_name = container_name self._is_initialized = False self._snapshot_file_folder = FileUtil.join_paths_to_dir( EnvUtil.get_pslx_env_variable(var='PSLX_SNAPSHOT_DIR'), self._container_name) self._start_time = None self._end_time = None self._logger = logger self._upstream_ops = [] self._backend = None self._status = Status.IDLE self._counter = defaultdict(int)
def __init__(self, exchange_name, topic_name, connection_str, logger=DummyUtil.dummy_logger()): super().__init__() self._logger = logger self._connection_str = connection_str self._topic_name = topic_name self._exchange_name = exchange_name self._connection = pika.BlockingConnection( pika.URLParameters(connection_str) ) self._channel = self._connection.channel() self._channel.exchange_declare( exchange=self._exchange_name, exchange_type='direct' ) self._logger.info("Start publisher with topic name [" + self._topic_name + '] in exchange [' + self._exchange_name + '].') self._emit_lock = threading.Lock()
def __init__(self, queue_name, connection_str, logger=DummyUtil.dummy_logger()): super().__init__() self._logger = logger self._connection = pika.BlockingConnection( pika.URLParameters(connection_str)) self._channel = self._connection.channel() self._queue_name = queue_name result = self._channel.queue_declare(queue='', exclusive=True) self._callback_queue = result.method.queue self._logger.info("Callback queue is [" + self._callback_queue + '].') self._channel.basic_consume(queue=self._callback_queue, on_message_callback=self.on_response, auto_ack=True) self._corr_id = None self._response = None
def __init__(self, client_name, server_url): super().__init__() self._client_name = client_name self._logger = DummyUtil.dummy_logger() self._server_url = server_url.replace('http://', '').replace('https://', '') self._channel = None
def __init__(self, logger=None): super().__init__() if not logger: self._logger = DummyUtil.dummy_logger() else: self._logger = logger
def __init__(self, partitioner, logger=DummyUtil.dummy_logger()): super().__init__() self._partitioner = partitioner self._logger = logger