예제 #1
0
 def setUp(self):
     conf: dict = {
         "host": "127.0.0.1",
         "port": 6379,
         "db": 4,
     }
     self.client = RedisWrapper(conf)
예제 #2
0
    def __init__(self, conf, redis_address):
        self.to_where = conf['send_to_where']
        self.redis = RedisWrapper(redis_address)
        self.data_original = None
        self.name = None
        self.communication = Communication(conf)

        if self.to_where == 'influxdb':
            self.db = InfluxdbWrapper(conf['influxdb'])
예제 #3
0
    def __init__(self, conf):
        self.redis = RedisWrapper(conf['redis'])
        self.watchdog = WatchDog(conf)
        self.app = conf['application']
        self.data = dict()
        self._name = 'communication'
        self.log = list()
        self.hash = None

        # 20-12-14 zhy: windows启动异常,communication中没有self.paths参数
        self.__init_paths()
        # 重启刷新缓存
        self.flush_data()
예제 #4
0
    def __init__(self, conf):
        self.redis = RedisWrapper(conf['redis'])
        self.etcd = EtcdWrapper(conf['etcd'])
        self.etcd_interval_time = conf['etcd']['interval']
        self.watchdog = WatchDog(conf)
        self.node = conf['node']
        self.ip = conf['local_ip']
        self.app = conf['application']
        self.paths = conf['paths']
        self.data = dict()
        self._name = 'communication'
        self.log = list()
        self.hash = None

        # 重启刷新缓存
        self.flush_data()
예제 #5
0
    def __init__(self, configuration):

        self.redis_conf = configuration['redis']
        self.conf = configuration['sender']
        self.lua_path = self.conf['lua_path']

        self.db = RedisWrapper(self.redis_conf)
        self.db.script_load(self.lua_path)

        # log format
        self.enque_log_flag = self.conf['enque_log']
        self.log_format = '\ntable_name: {}\nfields: {}\ntimestamp: {}\n'

        # init communication class (singleinstance)
        self.communication = Communication(configuration)

        self.name = None
예제 #6
0
    def __init__(self, conf, redis_address=None):
        self.to_where = conf['send_to_where']

        self.data_original = None
        self.name = None
        self.communication = Communication(conf)

        # Redis conf
        self.redis = RedisWrapper(redis_address)
        self.group = conf['data_stream']['group']
        self.consumer = conf['data_stream']['consumer']
        # create group for data_stream
        self.redis.addGroup(self.group)

        if self.to_where == 'influxdb':
            self.db = InfluxdbWrapper(conf['influxdb'])
        elif self.to_where == 'kafka':
            self.db = self.initKafka(conf['kafka'])
        elif self.to_where == 'mqtt':
            self.mqtt_conf = conf.get('mqtt', dict())
            self.mqtt_put_queue = Queue()
            self.mqtt = MqttWrapper(self.mqtt_conf)
예제 #7
0
 def __init__(self, conf):
     self.__redis = RedisWrapper(conf["redis"])
예제 #8
0
 def __init__(self, conf):
     redis_conf = conf['redis']
     web_conf = conf['web']
     self.__redis = RedisWrapper(redis_conf)
     self.set_name = web_conf.get('set_name', 'status')
     self.order_name = web_conf.get('order_status', 'get_status')
예제 #9
0
 def connect_redis(self):
     self.db = RedisWrapper(self.redis_conf)
     self.db.script_load(self.lua_path)