|
|
@@ -134,16 +134,8 @@ class StreamInserterNumpy(nilmdb.client.client.StreamInserter): |
|
|
|
contiguous interval and may be None. 'dtype' is the Numpy |
|
|
|
dtype for this stream. |
|
|
|
""" |
|
|
|
self.last_response = None |
|
|
|
|
|
|
|
super(StreamInserterNumpy, self).__init__(client, path, start, end) |
|
|
|
self._dtype = dtype |
|
|
|
self._client = client |
|
|
|
self._path = path |
|
|
|
|
|
|
|
# Start and end for the overall contiguous interval we're |
|
|
|
# filling |
|
|
|
self._interval_start = start |
|
|
|
self._interval_end = end |
|
|
|
|
|
|
|
# Max rows to send at once |
|
|
|
self._max_rows = self._max_data // self._dtype.itemsize |
|
|
@@ -251,9 +243,12 @@ class StreamInserterNumpy(nilmdb.client.client.StreamInserter): |
|
|
|
# Next block continues where this one ended |
|
|
|
self._interval_start = end_ts |
|
|
|
|
|
|
|
# If we have no endpoints, it's because we had no data to send. |
|
|
|
if start_ts is None or end_ts is None: |
|
|
|
return |
|
|
|
# If we have no endpoints, or equal endpoints, it's OK as long |
|
|
|
# as there's no data to send |
|
|
|
if (start_ts is None or end_ts is None) or (start_ts == end_ts): |
|
|
|
if len(array) == 0: |
|
|
|
return |
|
|
|
raise ClientError("have data to send, but invalid start/end times") |
|
|
|
|
|
|
|
# Send it |
|
|
|
data = array.tostring() |
|
|
|