Пример #1
0
    def read(self):
        timestamp = time.time()
        uids = [str(uuid.uuid4()) for ch in self.channels]

        bulk_insert_datum(self._filestore_res, uids,
                          self._get_datum_args(self._abs_trigger_count))

        self._abs_trigger_count += 1
        return {self.mds_keys[ch]: {'timestamp': timestamp,
                                    'value': uid,
                                    }
                for uid, ch in zip(uids, self.channels)
                }
Пример #2
0
    def bulk_read(self, timestamps):
        channels = self.channels
        ch_uids = {ch: [str(uuid.uuid4()) for ts in timestamps]
                   for ch in channels}

        count = len(timestamps)
        if count == 0:
            return {}

        def get_datum_args():
            for ch in channels:
                for seq_num in range(count):
                    yield {'frame': seq_num,
                           'channel': ch}

        uids = [ch_uids[ch] for ch in channels]
        bulk_insert_datum(self._filestore_res, itertools.chain(*uids),
                          get_datum_args())

        return {self.mds_keys[ch]: ch_uids[ch]
                for ch in channels
                }
Пример #3
0
 def bulk_read(self, timestamps):
     uids = list(str(uuid.uuid4()) for ts in timestamps)
     datum_args = (dict(point_number=i) for i in range(len(uids)))
     bulk_insert_datum(self._filestore_res, uids, datum_args)
     return {self._det.name: uids}