Пример #1
0
 def values(self):
     if self._values is None:
         start_time = time.time()
         self._values = []
         rows = _session.execute(cqlstatements._bound_statements['parameter_timeseries'].bind(
             (self._name, self._tag, self._p,)))
         for r in rows:
             cyclestamp = cassandra.util.datetime_from_uuid1(r[4])
             self._values.append([cyclestamp, _convert_object_from_cassandra(r[0], [r[1], r[2], r[3]])])
         self._values = np.array(sorted(list(self._values), key=lambda x: x[0])) 
         print("Data queried in %f seconds." % (time.time()-start_time,))
     return self._values
Пример #2
0
 def value(self):
     if self._value is None:
         if kepler._cache_flag:
             with kepler._thread_lock:
                 if not self._cycles._get_caching(self._p):
                     self._cycles._set_caching(self._p)
                     ParameterData.cachingThread(self._cycles, self._p).start()
         r = _session.execute(
             cqlstatements._bound_statements["parameter_data"].bind((self._name, self._tag, self._id, self._p))
         )
         r = r[0]
         self._value = _convert_object_from_cassandra(r[0], [r[1], r[2], r[3]])
     return self._value
Пример #3
0
 def _get_async_success(self, r):
     if r is None:
         print("Error retrieving a value for the cache")
     r = r[0]
     self._value = _convert_object_from_cassandra(r[0], [r[1], r[2], r[3]])