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


Python ServiceGroup.add_dep方法代码示例

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


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

示例1: test_prepare_empty_group_external_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_prepare_empty_group_external_deps(self):
     '''Test prepare an empty group with a single external dependency.'''
     group = ServiceGroup('GROUP')
     ext_serv = Service('EXT_SERV')
     ac_suc = Action('start', command='/bin/true')
     ext_serv.add_action(ac_suc)
     group.add_dep(ext_serv)
     group.run('start')
     self.assertEqual(ext_serv.status, DONE)
     self.assertEqual(group.status, MISSING)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:12,代码来源:ServiceGroupTest.py

示例2: test_eval_deps_status_error

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_eval_deps_status_error(self):
     '''Test the method eval_deps_status DEP_ERROR'''
     group = ServiceGroup('group')
     e1 = Service('E1')
     e2 = Service('E2')
     e1.status = DEP_ERROR
     group.add_dep(target=e1)
     group.add_dep(target=e2)
     group.add_inter_dep(target=Service('I1'))
     self.assertEqual(group.eval_deps_status(), DEP_ERROR)
     self.assertEqual(group.eval_deps_status(), DEP_ERROR)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:13,代码来源:ServiceGroupTest.py

示例3: test_eval_deps_status_done

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_eval_deps_status_done(self):
     '''Test the method eval_deps_status NO_STATUS'''
     group = ServiceGroup('group')
     e1 = Service('E1')
     e2 = Service('E2')
     group.add_dep(target=e1)
     group.add_dep(target=e2)
     group.add_inter_dep(target=Service('I1'))
     self.assertEqual(group.eval_deps_status(), NO_STATUS)
     e1.status = DONE
     e2.status = DONE
     self.assertEqual(group.eval_deps_status(), NO_STATUS)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:14,代码来源:ServiceGroupTest.py

示例4: test_eval_deps_status_ws

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_eval_deps_status_ws(self):
     '''Test the method eval_deps_status WAITING_STATUS'''
     group = ServiceGroup('group')
     ext1 = Service('E1')
     ext2 = Service('E2')
     ext1.status = DONE
     ext2.status = WARNING
     group.add_dep(target=ext1)
     group.add_dep(target=ext2)
     int1 = Service('E1')
     group.add_inter_dep(target=int1)
     int1.status = WAITING_STATUS
     self.assertEqual(group.eval_deps_status(), WAITING_STATUS)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:15,代码来源:ServiceGroupTest.py

示例5: test_group_with_weak_dep_error

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
    def test_group_with_weak_dep_error(self):
        """A group with a weak dep error runs fine (add_inter_dep())."""

        dep1 = Service('dep1')
        dep1.add_action(Action('stop', command='/bin/false'))

        grp = ServiceGroup('group')
        svc = Service('svc')
        svc.add_action(Action('stop', command='/bin/true'))
        grp.add_inter_dep(svc)
        grp.add_dep(dep1, sgth=REQUIRE_WEAK)
        grp.run('stop')

        self.assertEqual(grp.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:16,代码来源:ServiceGroupTest.py

示例6: test_filter

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
    def test_filter(self):
        """ServiceGroup supports filter dependency"""
        dep = Service('dep')
        dep.add_action(Action('stop', command='false', target=HOSTNAME))

        grp = ServiceGroup('group')
        svc = Service('svc')
        svc.add_action(Action('stop', command='true', target=HOSTNAME))
        grp.add_inter_dep(svc)
        grp.add_dep(dep, sgth=FILTER)
        grp.run('stop')

        self.assertEqual(dep.status, ERROR)
        self.assertEqual(svc.status, SKIPPED)
        self.assertEqual(grp.status, SKIPPED)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:17,代码来源:ServiceGroupTest.py

示例7: test_skipped_group_dep_error

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
    def test_skipped_group_dep_error(self):
        """A full SKIPPED service group with DEP_ERROR should be SKIPPED"""
        svc = Service('error')
        svc.add_action(Action('start', command='/bin/false'))
        grp = ServiceGroup('group')
        svc1 = Service('svc1')
        svc1.add_action(Action('start', target="@NOTHING", command=':'))
        svc2 = Service('svc2')
        svc2.add_action(Action('start', target="@NOTHING", command=':'))
        grp.add_inter_dep(target=svc1)
        grp.add_inter_dep(target=svc2)
        grp.add_dep(svc, sgth=REQUIRE)

        grp.run('start')
        self.assertEqual(svc.status, ERROR)
        self.assertEqual(grp.status, SKIPPED)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:18,代码来源:ServiceGroupTest.py

示例8: test_search_node_graph

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_search_node_graph(self):
     """Test search node in a graph trough a ServiceGroup"""
     group = ServiceGroup('GROUP')
     ser1 = Service('I1')
     ser2 = Service('I2')
     eser1 = Service('E1')
     eser2 = Service('E2')
     eser3 = Service('E3')
     group.add_inter_dep(target=ser1)
     group.add_inter_dep(target=ser2)
     group.add_dep(target=eser1, parent=False)
     group.add_dep(target=eser2)
     group.add_dep(target=eser3)
     self.assertTrue(group.search('I1'))
     self.assertTrue(group.search('E2'))
     self.assertTrue(eser1.search('I1'))
     self.assertTrue(eser1.search('E3'))
     self.assertFalse(group.search('E0'))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:20,代码来源:ServiceGroupTest.py

示例9: test_run_partial_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_run_partial_deps(self):
     '''Test start algorithm as soon as the calling point is done.'''
     serv = Service('NOT_CALLED')
     serv_a = ServiceGroup('CALLING_GROUP')
     serv_b = Service('SERV_1')
     serv_c = Service('SERV_2')
     act_suc1 = Action('start', command='/bin/true')
     act_suc2 = Action('start', command='/bin/true')
     serv_b.add_action(act_suc1)
     serv_c.add_action(act_suc2)
     serv.add_dep(serv_a)
     serv_a.add_dep(target=serv_b)
     serv_a.add_inter_dep(target=serv_c)
     serv_a.run('start')
     self.assertEqual(serv.status, NO_STATUS)
     self.assertEqual(serv_a.status, DONE)
     self.assertEqual(serv_b.status, DONE)
     self.assertEqual(serv_c.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:20,代码来源:ServiceGroupTest.py

示例10: test_prepare_group_with_errors_one

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_prepare_group_with_errors_one(self):
     '''Test prepare a group terminated by WARNING'''
     # Group
     group = ServiceGroup('GROUP')
     # Internal
     inter_serv1 = Service('INT_SERV1')
     inter_serv2 = Service('INT_SERV2')
     inter_serv3 = Service('INT_SERV3')
     # External
     ext_serv1 =  Service('EXT_SERV1')
     ext_serv2 = Service('EXT_SERV2')
     ac_suc1 = Action('start', command='/bin/true')
     ac_suc2 = Action('start', command='/bin/true')
     ac_suc3 = Action('start', command='/bin/true')
     ac_err1 = Action('start', command='/bin/false')
     ac_err2 = Action('start', command='/bin/false')
     # Add actions
     inter_serv1.add_action(ac_suc1)
     inter_serv2.add_action(ac_suc2)
     inter_serv3.add_action(ac_err1)
     ext_serv1.add_action(ac_suc3)
     ext_serv2.add_action(ac_err2)
     # Add dependencies
     group.add_inter_dep(target=inter_serv1)
     group.add_inter_dep(target=inter_serv2)
     group.add_inter_dep(base=inter_serv2, target=inter_serv3,
         sgth=REQUIRE_WEAK)
     group.add_dep(ext_serv1)
     group.add_dep(target=ext_serv2, sgth=REQUIRE_WEAK)
     # Prepare group
     group.run('start')
     self.assertEqual(group.status, DONE)
     self.assertEqual(ext_serv1.status, DONE)
     self.assertEqual(ext_serv2.status, ERROR)
     self.assertEqual(inter_serv1.status, DONE)
     self.assertEqual(inter_serv2.status, DONE)
     self.assertEqual(inter_serv3.status, ERROR)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:39,代码来源:ServiceGroupTest.py

示例11: test_prepare_group_internal_external_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_prepare_group_internal_external_deps(self):
     '''Test prepare a group with internal and external dependencies'''
     # Group
     group = ServiceGroup('GROUP')
     # Internal
     inter_serv1 = Service('INT_SERV1')
     inter_serv2 = Service('INT_SERV2')
     inter_serv3 = Service('INT_SERV3')
     # External
     ext_serv1 =  Service('EXT_SERV1')
     ext_serv2 = Service('EXT_SERV2')
     ac_suc1 = Action('start', command='/bin/true')
     ac_suc2 = Action('start', command='/bin/true')
     ac_suc3 = Action('start', command='/bin/true')
     ac_suc4 = Action('start', command='/bin/true')
     ac_suc5 = Action('start', command='/bin/true')
     # Add actions
     inter_serv1.add_action(ac_suc1)
     inter_serv2.add_action(ac_suc2)
     inter_serv3.add_action(ac_suc3)
     ext_serv1.add_action(ac_suc4)
     ext_serv2.add_action(ac_suc5)
     # Add dependencies
     group.add_inter_dep(target=inter_serv1)
     group.add_inter_dep(target=inter_serv2)
     group.add_inter_dep(base=inter_serv2, target=inter_serv3)
     group.add_dep(ext_serv1)
     group.add_dep(ext_serv2)
     # Prepare group
     group.run('start')
     self.assertEqual(group.status, DONE)
     self.assertEqual(ext_serv1.status, DONE)
     self.assertEqual(ext_serv2.status, DONE)
     self.assertEqual(inter_serv1.status, DONE)
     self.assertEqual(inter_serv2.status, DONE)
     self.assertEqual(inter_serv3.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:38,代码来源:ServiceGroupTest.py

示例12: test_add_dep_service_group

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import add_dep [as 别名]
 def test_add_dep_service_group(self):
     '''Test ability to add dependencies to a ServiceGroup'''
     ser_group = ServiceGroup('GROUP')
     s1 = Service('alpha')
     s1.add_action(Action('start', HOSTNAME, '/bin/true'))
     s2 = Service('beta')
     s2.add_action(Action('action', HOSTNAME, '/bin/true'))
     s3 = Service('lambda')
     ser_group.add_inter_dep(target=s1)
     ser_group.add_inter_dep(target=s2)
     ser_group.add_dep(target=s3)
     self.assertTrue(ser_group.has_action('start'))
     self.assertTrue(ser_group.has_action('action'))
     self.assertTrue(s1.name in ser_group._source.parents)
     self.assertTrue(s1.name in ser_group._sink.children)
     self.assertTrue(s2.name in ser_group._source.parents)
     self.assertTrue(s2.name in ser_group._sink.children)
     self.assertFalse(s3.name in ser_group.children)
     self.assertTrue(s3.name in ser_group.parents)
     s4 = Service('theta')
     s4.add_action(Action('fire', HOSTNAME,'/bin/true'))
     ser_group.add_dep(target=s4, parent=False)
     self.assertTrue(s4.name in ser_group.children)
     self.assertTrue(s4.has_parent_dep(ser_group.name))
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:26,代码来源:ServiceGroupTest.py


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