当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.consolidate方法代码示例

本文整理汇总了Python中graphite.render.datalib.TimeSeries.consolidate方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.consolidate方法的具体用法?Python TimeSeries.consolidate怎么用?Python TimeSeries.consolidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在graphite.render.datalib.TimeSeries的用法示例。


在下文中一共展示了TimeSeries.consolidate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_TimeSeries_iterate_valuesPerPoint_2_none_values

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
    def test_TimeSeries_iterate_valuesPerPoint_2_none_values(self):
      values = [None, None, None, None, None]

      series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values)
      self.assertEqual(series.valuesPerPoint, 1)

      series.consolidate(2)
      self.assertEqual(series.valuesPerPoint, 2)
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, None])

      values = [None, None, None, None, None, 1, 2, 3, 4]

      series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values, xFilesFactor=0.1)
      self.assertEqual(series.valuesPerPoint, 1)
      self.assertEqual(series.xFilesFactor, 0.1)

      series.consolidate(2)
      self.assertEqual(series.valuesPerPoint, 2)

      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, 1, 2.5, 4])
      self.assertEqual(list(series), list(expected))

      series.xFilesFactor = 0.5
      self.assertEqual(list(series), list(expected))

      series.xFilesFactor = 0.500001
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, None, 2.5, None])
      self.assertEqual(list(series), list(expected))

      series.xFilesFactor = 1
      self.assertEqual(list(series), list(expected))
开发者ID:aihua,项目名称:graphite-web,代码行数:33,代码来源:test_render_datalib.py

示例2: test_TimeSeries_iterate_valuesPerPoint_2_min

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
 def test_TimeSeries_iterate_valuesPerPoint_2_min(self):
   values = range(0,100)
   series = TimeSeries("collectd.test-db.load.value", 0, 5, 1, values, consolidate='min')
   self.assertEqual(series.valuesPerPoint, 1)
   series.consolidate(2)
   self.assertEqual(series.valuesPerPoint, 2)
   expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, range(0,100,2)+[None])
   self.assertEqual(list(series), list(expected))
开发者ID:gwaldo,项目名称:graphite-web,代码行数:10,代码来源:test_render_datalib.py

示例3: test_TimeSeries_iterate_valuesPerPoint_2_avg

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
 def test_TimeSeries_iterate_valuesPerPoint_2_avg(self):
   values = range(0,100)
   series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values)
   self.assertEqual(series.valuesPerPoint, 1)
   series.consolidate(2)
   self.assertEqual(series.valuesPerPoint, 2)
   expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [0.5, 2.5, 4.5, 6.5, 8.5, 10.5, 12.5, 14.5, 16.5, 18.5, 20.5, 22.5, 24.5, 26.5, 28.5, 30.5, 32.5, 34.5, 36.5, 38.5, 40.5, 42.5, 44.5, 46.5, 48.5, 50.5, 52.5, 54.5, 56.5, 58.5, 60.5, 62.5, 64.5, 66.5, 68.5, 70.5, 72.5, 74.5, 76.5, 78.5, 80.5, 82.5, 84.5, 86.5, 88.5, 90.5, 92.5, 94.5, 96.5, 98.5, None])
   self.assertEqual(list(series), list(expected))
开发者ID:gwaldo,项目名称:graphite-web,代码行数:10,代码来源:test_render_datalib.py

示例4: test_TimeSeries_iterate_valuesPerPoint_2_none_values

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
 def test_TimeSeries_iterate_valuesPerPoint_2_none_values(self):
   values = [None, None, None, None, None]
   series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values)
   self.assertEqual(series.valuesPerPoint, 1)
   series.consolidate(2)
   self.assertEqual(series.valuesPerPoint, 2)
   expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, [None, None, None])
   self.assertEqual(list(series), list(expected))
开发者ID:gwaldo,项目名称:graphite-web,代码行数:10,代码来源:test_render_datalib.py

示例5: test_TimeSeries_consolidate

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
    def test_TimeSeries_consolidate(self):
      values = list(range(0,100))

      series = TimeSeries("collectd.test-db.load.value", 0, len(values)/2, 1, values)
      self.assertEqual(series.valuesPerPoint, 1)

      series.consolidate(2)
      self.assertEqual(series.valuesPerPoint, 2)
开发者ID:aihua,项目名称:graphite-web,代码行数:10,代码来源:test_render_datalib.py

示例6: test_TimeSeries_iterate_valuesPerPoint_2_invalid

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
 def test_TimeSeries_iterate_valuesPerPoint_2_invalid(self):
   values = range(0,100)
   series = TimeSeries("collectd.test-db.load.value", 0, 5, 1, values, consolidate='bogus')
   self.assertEqual(series.valuesPerPoint, 1)
   series.consolidate(2)
   self.assertEqual(series.valuesPerPoint, 2)
   expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, range(0,100,2)+[None])
   with self.assertRaisesRegexp(Exception, "Invalid consolidation function: 'bogus'"):
     result = list(series)
开发者ID:gwaldo,项目名称:graphite-web,代码行数:11,代码来源:test_render_datalib.py

示例7: test_TimeSeries_iterate_valuesPerPoint_2_last

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
    def test_TimeSeries_iterate_valuesPerPoint_2_last(self):
      values = list(range(0,100))

      series = TimeSeries("collectd.test-db.load.value", 0, 5, 1, values, consolidate='last')
      self.assertEqual(series.valuesPerPoint, 1)

      series.consolidate(2)
      self.assertEqual(series.valuesPerPoint, 2)
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(1,100,2)))
      self.assertEqual(list(series), list(expected))

      series.consolidate(3)
      self.assertEqual(series.valuesPerPoint, 3)
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(2,100,3)) + [99])
      self.assertEqual(list(series), list(expected))
开发者ID:aihua,项目名称:graphite-web,代码行数:17,代码来源:test_render_datalib.py

示例8: test_TimeSeries_iterate_valuesPerPoint_2_sum

# 需要导入模块: from graphite.render.datalib import TimeSeries [as 别名]
# 或者: from graphite.render.datalib.TimeSeries import consolidate [as 别名]
    def test_TimeSeries_iterate_valuesPerPoint_2_sum(self):
      values = list(range(0,100))

      series = TimeSeries("collectd.test-db.load.value", 0, 5, 1, values, consolidate='sum')
      self.assertEqual(series.valuesPerPoint, 1)

      series.consolidate(2)
      self.assertEqual(series.valuesPerPoint, 2)
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(1,200,4)))
      self.assertEqual(list(series), list(expected))

      series.consolidate(3)
      self.assertEqual(series.valuesPerPoint, 3)
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(3,300,9)) + [99])
      self.assertEqual(list(series), list(expected))

      series.xFilesFactor = 0.4
      expected = TimeSeries("collectd.test-db.load.value", 0, 5, 1, list(range(3,300,9)) + [None])
      self.assertEqual(list(series), list(expected))
开发者ID:aihua,项目名称:graphite-web,代码行数:21,代码来源:test_render_datalib.py


注:本文中的graphite.render.datalib.TimeSeries.consolidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。