Package: python3-whisper
Version: 1.1.4-2

The whisper-resize script assumes Python 2, despite being in a python3-
package:

root@monitor:/var/lib/graphite/whisper/snmp# whisper-resize --nobackup
--aggregate
./escalabra/snmp/if_octets-Slot__0_Port__4_Gigabit_-_Level/rx.wsp 10s:1d
1m:7d 10m:1y
Retrieving all data from the archives
Creating new whisper database:
./escalabra/snmp/if_octets-Slot__0_Port__4_Gigabit_-_Level/rx.wsp.tmp
Created:
./escalabra/snmp/if_octets-Slot__0_Port__4_Gigabit_-_Level/rx.wsp.tmp
(855412 bytes)
Migrating data with aggregation...
oldtimestamps: <map object at 0x7fc7a06259e8>
(1568833216,1568919626,10)
timepoints_to_update: range(1568833216, 1568919626, 10)
Traceback (most recent call last):
  File "/usr/bin/whisper-resize", line 147, in <module>
    lefti = bisect.bisect_left(oldtimestamps, tinterval[0])
TypeError: object of type 'map' has no len()

A patch for these issues is attached.

ttfn/rjk
--- whisper-resize	2018-12-12 11:42:45.000000000 +0000
+++ whisper-resize.fixed	2019-09-19 20:06:27.867197176 +0100
@@ -110,7 +110,7 @@
   for archive in old_archives:
     # Loading all datapoints into memory for fast querying
     timeinfo, values = archive['data']
-    new_datapoints = zip(range(*timeinfo), values)
+    new_datapoints = list(zip(range(*timeinfo), values))
     if all_datapoints:
       last_timestamp = all_datapoints[-1][0]
       slice_end = 0
@@ -122,8 +122,8 @@
     else:
       all_datapoints += new_datapoints
 
-  oldtimestamps = map(lambda p: p[0], all_datapoints)
-  oldvalues = map(lambda p: p[1], all_datapoints)
+  oldtimestamps = list(map(lambda p: p[0], all_datapoints))
+  oldvalues = list(map(lambda p: p[1], all_datapoints))
 
   print("oldtimestamps: %s" % oldtimestamps)
   # Simply cleaning up some used memory
@@ -148,7 +148,7 @@
       righti = bisect.bisect_left(oldtimestamps, tinterval[1], lo=lefti)
       newvalues = oldvalues[lefti:righti]
       if newvalues:
-        non_none = filter(lambda x: x is not None, newvalues)
+        non_none = list(filter(lambda x: x is not None, newvalues))
         if 1.0 * len(non_none) / len(newvalues) >= xff:
           newdatapoints.append([tinterval[0],
                                 whisper.aggregate(aggregationMethod,

Reply via email to