Exemplo n.º 1
0
	def __init__(self, path, uri, heartbeat):
		MeanerBase.__init__(self, path)

		self.hub_uri = uri

		self.context = zmq.Context(1)
		self.socket = self.context.socket(zmq.SUB)
		self.heartbeat_interval = heartbeat
		self.last_heartbeat = None

		p = create_hearbeat_param()
		self.heartbeat_param = saveparam.SaveParam(p, self.szbase_path)
Exemplo n.º 2
0
    def __init__(self, config_dir, offset, count):
        self.offset = offset
        self.count = count

        sz4_dir = os.path.join(config_dir, "sz4")
        self.szbase_dir = os.path.join(config_dir, "szbase")

        self.ipk = ipk.IPK(config_dir + "/config/params.xml")

        self.s_params = {}

        for p in self.ipk.params:
            sp = saveparam.SaveParam(p, sz4_dir, FileFactory(), False)
            self.s_params[p.param_name] = sp

        self.s_params[heartbeat_param_name] = saveparam.SaveParam(create_hearbeat_param(), sz4_dir, FileFactory())
Exemplo n.º 3
0
    def __init__(self, config_dir, offset, count):
        self.offset = offset
        self.count = count

        sz4_dir = os.path.join(config_dir, "sz4")
        self.szbase_dir = os.path.join(config_dir, "szbase")

        self.ipk = ipk.IPK(config_dir + "/config/params.xml")

        self.s_params = {}

        for p in self.ipk.params:
            sp = saveparam.SaveParam(p, sz4_dir, FileFactory(), False)
            self.s_params[p.param_name] = sp

        self.s_params[heartbeat_param_name] = saveparam.SaveParam(
            create_hearbeat_param(), sz4_dir, FileFactory())
Exemplo n.º 4
0
	def __init__(self, path, uri, heartbeat, interval):
		MeanerBase.__init__(self, path)

		self.hub_uri = uri

		self.context = zmq.Context(1)
		self.socket = self.context.socket(zmq.SUB)

		self.last_heartbeat = None

		self.heartbeat_interval = heartbeat
		self.last_meaner4_heartbeat = None

		self.saving_interval = interval
		self.saving_time = 0

		self.heartbeat_param = saveparam.SaveParam(create_hearbeat_param(), self.szbase_path)
		self.meaner4_heartbeat_param = saveparam.SaveParam(create_meaner4_heartbeat_param(), self.szbase_path)

		self.msgs = {}
Exemplo n.º 5
0
	def __init__(self, path, uri, heartbeat, interval):
		MeanerBase.__init__(self, path)

		self.hub_uri = uri

		self.context = zmq.Context(1)
		self.socket = self.context.socket(zmq.SUB)

		self.last_heartbeat = None

		self.heartbeat_interval = heartbeat
		self.last_meaner4_heartbeat = None

		self.saving_interval = interval
		self.saving_time = 0

		self.heartbeat_param = saveparam.SaveParam(create_hearbeat_param(), self.szbase_path)
		self.meaner4_heartbeat_param = saveparam.SaveParam(create_meaner4_heartbeat_param(), self.szbase_path)

		self.msgs = {}
Exemplo n.º 6
0
    def __init__(self, config_dir, szc_dir, offset, current, queue):
        self.offset = offset
        self.current = current

        self.szbase_dir = os.path.join(config_dir, "szbase")

        self.ipk = ipk.IPK(config_dir + "/config/params.xml")
        self.szc_dir = szc_dir

        self.s_params = {}

        del parampath.ParamPath.find_latest_path
        parampath.ParamPath.find_latest_path = lambda self: None

        delta_cache = {}

        def get_time_delta_cached(self, time_from, time_to):
            diff = time_to - time_from
            if diff < 0:
                raise TimeError(time_from, time_to)

            if diff in delta_cache:
                return delta_cache[diff]
            else:
                delta = timedelta.encode(diff)
                delta_cache[diff] = delta
                return delta

        del lastentry.LastEntry.get_time_delta
        lastentry.LastEntry.get_time_delta = get_time_delta_cached

        for p in self.ipk.params:
            sp = saveparam.SaveParam(p, self.szbase_dir, FileFactory(), False)
            self.s_params[p.param_name] = sp

        self.s_params[heartbeat_param_name] = saveparam.SaveParam(
            create_hearbeat_param(), self.szbase_dir, FileFactory())

        self.queue = queue
Exemplo n.º 7
0
	def __init__(self, config_dir, szc_dir, offset, current, queue):
		self.offset = offset
		self.current = current

		self.szbase_dir = os.path.join(config_dir, "szbase")

		self.ipk = ipk.IPK(config_dir + "/config/params.xml")
		self.szc_dir = szc_dir

		self.s_params = {}

		del parampath.ParamPath.find_latest_path 
		parampath.ParamPath.find_latest_path = lambda self: None

		delta_cache = {}
		def get_time_delta_cached(self, time_from, time_to):
			diff = time_to - time_from
			if diff < 0:
				raise TimeError(time_from, time_to)

			if diff in delta_cache:
				return delta_cache[diff]
			else:
				delta = timedelta.encode(diff)
				delta_cache[diff] = delta
				return delta	

		del lastentry.LastEntry.get_time_delta
		lastentry.LastEntry.get_time_delta = get_time_delta_cached

		for p in self.ipk.params:
			sp = saveparam.SaveParam(p, self.szbase_dir, FileFactory(), False)
			self.s_params[p.param_name] = sp
	
		self.s_params[heartbeat_param_name] = saveparam.SaveParam(create_hearbeat_param(), self.szbase_dir, FileFactory())

		self.queue = queue