Ralph Bean committed e328e3b

Made steps a param

Comments (0)

Files changed (1)


         "Overridden if `start` and `end` are specified.",
+    steps = twc.Param("Number of datapoints to gather.", default=100)
     def file2name(cls, fname):
         return fname.split('/')[-1].split('.')[0]
-    def fetch(cls, cf='AVERAGE', steps=100):
+    def fetch(cls, cf='AVERAGE'):
         if not hasattr(cls, 'end'):
             cls.end =
         start_s = int(time.mktime(cls.start.timetuple()))
         # Convert `steps` to `resolution` (seconds per step)
-        resolution = (end_s - start_s)/steps
+        resolution = (end_s - start_s)/cls.steps
         labels = [item[0] for item in rrd_filenames]
         rrds = [pyrrd.rrd.RRD(item[1]) for item in rrd_filenames]
         # Query the round robin database
         # TODO -- are there other things to return other than 'sum'?
+        # TODO -- resolution is actually irrelevant.  need to fix that
         data = [d.fetch(cf, resolution, start_s, end_s)['sum'] for d in rrds]
         # Convert from 'nan' to 0.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.