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


Python Action.maxretry方法代码示例

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


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

示例1: test_retry_timeout

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_retry_timeout(self):
     """Test retry behaviour when timeout"""
     action = Action("start", command="/bin/sleep 0.5", timeout=0.1)
     action.delay = 0.1
     action.maxretry = 2
     service = Service("retry")
     service.add_action(action)
     service.run("start")
     self.assertEqual(action.tries, 3)
     self.assertEqual(action.status, TIMEOUT)
     self.assertTrue(0.6 < action.duration < 0.8, "%.3f is not between 0.6 and 0.8" % action.duration)
开发者ID:mdlx,项目名称:milkcheck,代码行数:13,代码来源:ActionTest.py

示例2: test_retry_error

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_retry_error(self):
     """Test retry behaviour when errors"""
     action = Action("start", command="/bin/false")
     action.delay = 0.1
     action.maxretry = 3
     service = Service("retry")
     service.add_action(action)
     service.run("start")
     self.assertEqual(action.tries, 4)
     self.assertEqual(action.status, ERROR)
     self.assertTrue(0.3 < action.duration < 0.5, "%.3f is not between 0.3 and 0.5" % action.duration)
开发者ID:mdlx,项目名称:milkcheck,代码行数:13,代码来源:ActionTest.py

示例3: test_retry_timeout

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_retry_timeout(self):
     """Test retry behaviour when timeout"""
     action = Action('start', command='/bin/sleep 0.5', timeout=0.1)
     action.delay = 0.1
     action.maxretry = 2
     service = Service('retry')
     service.add_action(action)
     service.run('start')
     self.assertEqual(action.tries, 3)
     self.assertEqual(action.status, TIMEOUT)
     self.assertTrue(0.59 <= action.duration <= 0.8,
                     "%.3f is not between 0.59 and 0.8" % action.duration)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:14,代码来源:ActionTest.py

示例4: test_reset_action

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_reset_action(self):
     """Test resest values of an action"""
     action = Action(name="start", target="fortoy5", command="/bin/true", timeout=10, delay=5)
     action.maxretry = 5
     action.tries = 4
     action.worker = "test"
     action.start_time = "00:20:30"
     action.stop_time = "00:20:30"
     action.reset()
     self.assertEqual(action.tries, 0)
     self.assertEqual(action.worker, None)
     self.assertEqual(action.start_time, None)
     self.assertEqual(action.stop_time, None)
     self.assertEqual(action.status, NO_STATUS)
开发者ID:mdlx,项目名称:milkcheck,代码行数:16,代码来源:ActionTest.py

示例5: test_reset_action

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_reset_action(self):
     '''Test resest values of an action'''
     action = Action(name='start', target='fortoy5', command='/bin/true',
                     timeout=10, delay=5)
     action.maxretry = 5
     action.tries = 4
     action.worker = 'test'
     action.start_time = 1444253681.36017
     action.stop_time = 1444253681.36017
     action.reset()
     self.assertEqual(action.tries, 0)
     self.assertEqual(action.worker, None)
     self.assertEqual(action.start_time, None)
     self.assertEqual(action.stop_time, None)
     self.assertEqual(action.status, NO_STATUS)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:17,代码来源:ActionTest.py

示例6: test_reset_service_group

# 需要导入模块: from MilkCheck.Engine.Action import Action [as 别名]
# 或者: from MilkCheck.Engine.Action.Action import maxretry [as 别名]
 def test_reset_service_group(self):
     '''Test the ability to reset values of a service group'''
     group = ServiceGroup('GROUP')
     ser1 = Service('I1')
     action = Action(name='start', delay=3)
     action.maxretry = 5
     action.tries = 3
     action.status = DONE
     ser1.add_action(action)
     ser1.status = ERROR
     group.add_inter_dep(target=ser1)
     group.status = DEP_ERROR
     group.reset()
     self.assertEqual(group.status, NO_STATUS)
     self.assertEqual(ser1.status, NO_STATUS)
     self.assertEqual(action.status, NO_STATUS)
     self.assertEqual(action.tries, 0)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:19,代码来源:ServiceGroupTest.py


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