Esempio n. 1
0
 def __init__(self, client_name, server_url):
     super().__init__()
     self._client_name = client_name
     self._logger = DummyUtil.dummy_logging()
     self._server_url = server_url.replace('http://',
                                           '').replace('https://', '')
     self._channel = None
Esempio n. 2
0
    def __init__(self, logger=None):
        super().__init__()
        if not logger:
            self._logger = DummyUtil.dummy_logging()
        else:
            self._logger = logger

        self._reader_status = Status.IDLE
        self._writer_status = Status.IDLE
Esempio n. 3
0
 def __init__(self, connection_str, logger=DummyUtil.dummy_logging()):
     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
Esempio n. 4
0
 def __init__(self, ws_url, params, logger=DummyUtil.dummy_logging()):
     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)
Esempio n. 5
0
 def __init__(self, service_name, rpc_storage=None):
     Base.__init__(self)
     self._logger = DummyUtil.dummy_logging()
     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_log("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 = {}
Esempio n. 6
0
    def __init__(self,
                 exchange,
                 queue_name,
                 connection_str,
                 logger=DummyUtil.dummy_logging()):
        super().__init__()
        self._logger = logger
        self._connection = pika.BlockingConnection(
            pika.URLParameters(connection_str))
        self._channel = self._connection.channel()
        self._queue_name = queue_name
        self._exchange = exchange
        self._channel.confirm_delivery()
        self._channel.basic_consume(queue=queue_name,
                                    on_message_callback=self.on_response,
                                    auto_ack=True)

        self._corr_id = None
        self._response = None
Esempio n. 7
0
 def __init__(self, container_name, logger=DummyUtil.dummy_logging(), ttl=-1):
     super().__init__()
     self._container_name = container_name
     self._is_initialized = False
     self._snapshot_file_folder = FileUtil.join_paths_to_dir_with_mode(
         root_dir=FileUtil.join_paths_to_dir(
             root_dir=EnvUtil.get_pslx_env_variable(var='PSLX_DATABASE'),
             base_name='snapshots'
         ),
         base_name=self.get_class_name() + '__' + container_name,
         ttl=ttl
     )
     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)