本文整理汇总了Python中stacktach.views.start_kpi_tracking函数的典型用法代码示例。如果您正苦于以下问题:Python start_kpi_tracking函数的具体用法?Python start_kpi_tracking怎么用?Python start_kpi_tracking使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了start_kpi_tracking函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_start_kpi_tracking_not_from_api
def test_start_kpi_tracking_not_from_api(self):
raw = self.mox.CreateMockAnything()
raw.event = 'compute.instance.update'
raw.service = 'compute'
self.mox.ReplayAll()
views.start_kpi_tracking(None, raw)
self.mox.VerifyAll()
示例2: test_start_kpi_tracking_not_using_host
def test_start_kpi_tracking_not_using_host(self):
lifecycle = self.mox.CreateMockAnything()
tracker = self.mox.CreateMockAnything()
when = utils.decimal_utc()
raw = utils.create_raw(self.mox, when, 'compute.instance.update',
host='api.example.com', service='compute')
self.mox.ReplayAll()
views.start_kpi_tracking(lifecycle, raw)
self.mox.VerifyAll()
示例3: test_start_kpi_tracking
def test_start_kpi_tracking(self):
lifecycle = self.mox.CreateMockAnything()
tracker = self.mox.CreateMockAnything()
when = utils.decimal_utc()
raw = utils.create_raw(self.mox, when, 'compute.instance.update',
host='nova.example.com', service='api')
views.STACKDB.create_request_tracker(lifecycle=lifecycle,
request_id=REQUEST_ID_1,
start=when,
last_timing=None,
duration=str(0.0))\
.AndReturn(tracker)
views.STACKDB.save(tracker)
self.mox.ReplayAll()
views.start_kpi_tracking(lifecycle, raw)
self.mox.VerifyAll()
示例4: test_aggregate_lifecycle_update
def test_aggregate_lifecycle_update(self):
event = 'compute.instance.update'
when = datetime.datetime.utcnow()
raw = utils.create_raw(self.mox, when, event, old_task='reboot')
views.STACKDB.find_lifecycles(instance=INSTANCE_ID_1).AndReturn([])
lifecycle = self.mox.CreateMockAnything()
lifecycle.instance = INSTANCE_ID_1
views.STACKDB.create_lifecycle(instance=INSTANCE_ID_1).AndReturn(lifecycle)
views.STACKDB.save(lifecycle)
self.mox.StubOutWithMock(views, "start_kpi_tracking")
views.start_kpi_tracking(lifecycle, raw)
self.mox.ReplayAll()
views.aggregate_lifecycle(raw)
self.assertEqual(lifecycle.last_raw, raw)
self.assertEqual(lifecycle.last_state, 'active')
self.assertEqual(lifecycle.last_task_state, 'reboot')
self.mox.VerifyAll()
示例5: test_start_kpi_tracking_not_update
def test_start_kpi_tracking_not_update(self):
raw = self.mox.CreateMockAnything()
raw.event = 'compute.instance.create.start'
self.mox.ReplayAll()
views.start_kpi_tracking(None, raw)
self.mox.VerifyAll()