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


Python ServiceGroup.run方法代码示例

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


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

示例1: test_prepare_group_subservices

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
    def test_prepare_group_subservices(self):
        '''Test prepare group with multiple internal dependencies.'''
        group = ServiceGroup('GROUP')
        ac_suc1 = Action('start', command='/bin/true')
        ac_suc2 = Action('start', command='/bin/true')
        ac_suc3 = Action('start', command='/bin/true')

        subserv_a = Service('SUB1')
        subserv_b = Service('SUB2')
        subserv_c = Service('SUB3')

        subserv_a.add_action(ac_suc1)
        subserv_b.add_action(ac_suc2)
        subserv_c.add_action(ac_suc3)

        group.add_inter_dep(target=subserv_a)
        group.add_inter_dep(target=subserv_b)
        group.add_inter_dep(base=subserv_a, target=subserv_c)
        group.add_inter_dep(base=subserv_b, target=subserv_c)

        group.run('start')
        self.assertEqual(group.status, DONE)
        self.assertEqual(subserv_a.status, DONE)
        self.assertEqual(subserv_b.status, DONE)
        self.assertEqual(subserv_c.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:27,代码来源:ServiceGroupTest.py

示例2: test_core_behaviour_reverse

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
    def test_core_behaviour_reverse(self):
        '''Test ability of the core to solve a large graph in reverse mode'''
        # Define Group 1
        grp1 = ServiceGroup('GRP1')
        grp1.algo_reversed = True
        grp1_i1 = Service('I1')
        grp1_i1.algo_reversed = True
        grp1_i2 = Service('I2')
        grp1_i2.algo_reversed = True
        grp1_i3 = Service('I3')
        grp1_i3.algo_reversed = True
        grp1_i1.add_action(Action('stop', command='/bin/true'))
        grp1_i2.add_action(Action('stop', command='/bin/true'))
        grp1_i3.add_action(Action('stop', command='/bin/true'))
        grp1.add_inter_dep(target=grp1_i1)
        grp1.add_inter_dep(base=grp1_i1, target=grp1_i2)
        grp1.add_inter_dep(target=grp1_i3)

        # Define Group 2
        grp2 = ServiceGroup('GRP2')
        grp2.algo_reversed = True
        grp2_i1 = Service('I1')
        grp2_i1.algo_reversed = True
        grp2_i2 = Service('I2')
        grp2_i2.algo_reversed = True
        grp2_i1.add_action(Action('stop', command='/bin/true'))
        grp2_i2.add_action(Action('stop', command='/bin/true'))
        grp2.add_inter_dep(target=grp2_i1)
        grp2.add_inter_dep(base=grp2_i1, target=grp2_i2)

        # Define Group init
        svc1 = Service('S1')
        svc1.algo_reversed = True
        svc1.add_action(Action('stop', command='/bin/true'))
        svc2 = Service('S2')
        svc2.algo_reversed = True
        svc2.add_action(Action('stop', command='/bin/true'))
        svc3 = Service('S3')
        svc3.algo_reversed = True
        svc3.add_action(Action('stop', command='/bin/true'))
        group_init = ServiceGroup('GROUP_INIT')
        group_init.algo_reversed = True
        group_init.add_inter_dep(target=svc1)
        group_init.add_inter_dep(base=svc1, target=svc2, sgth=REQUIRE_WEAK)
        group_init.add_inter_dep(base=svc1, target=grp1)
        group_init.add_inter_dep(base=svc2, target=svc3)
        group_init.add_inter_dep(base=grp1, target=svc3)
        group_init.add_inter_dep(base=svc3, target=grp2)

        # Solve the graph
        group_init.run('stop')

        # Assertions
        self.assertEqual(grp2.status, DONE)
        self.assertEqual(svc3.status, DONE)
        self.assertEqual(svc2.status, DONE)
        self.assertEqual(grp1.status, DONE)
        self.assertEqual(svc1.status, DONE)
        self.assertEqual(group_init.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:61,代码来源:CoreTests.py

示例3: test_missing_group

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
 def test_missing_group(self):
     """A group with only MISSING services should be MISSING"""
     grp = ServiceGroup('group')
     svc1 = Service('svc1')
     svc1.add_action(Action('stop', command='/bin/true'))
     grp.add_inter_dep(target=svc1)
     grp.run('start')
     self.assertEqual(grp.status, MISSING)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:10,代码来源:ServiceGroupTest.py

示例4: test_prepare_group_subservice

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
 def test_prepare_group_subservice(self):
     '''Test prepare group with an internal dependency.'''
     group = ServiceGroup('GROUP')
     subserv = Service('SUB1')
     subserv.add_action(Action('start', command='/bin/true'))
     group.add_inter_dep(target=subserv)
     group.run('start')
     self.assertEqual(group.status, DONE)
     self.assertEqual(subserv.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:11,代码来源:ServiceGroupTest.py

示例5: test_prepare_empty_group_external_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例6: test_skipped_group

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
 def test_skipped_group(self):
     """A group with only SKIPPED services should be SKIPPED"""
     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.run('start')
     self.assertEqual(grp.status, SKIPPED)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:13,代码来源:ServiceGroupTest.py

示例7: test_group_with_weak_dep_error

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例8: test_filter

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例9: test_run_stop_on_group

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
 def test_run_stop_on_group(self):
     '''Test stop algorithm on a group'''
     group = ServiceGroup('G1')
     i1 = Service('I1')
     i1.add_action(Action('stop', command='/bin/true'))
     group.add_inter_dep(target=i1)
     s1 = Service('S1')
     s1.add_action(Action('stop', command='/bin/true'))
     s1.add_dep(target=group)
     s1.algo_reversed = True
     group.algo_reversed = True
     group.run('stop')
     self.assertEqual(s1.status, DONE)
     self.assertEqual(i1.status, DONE)
     self.assertEqual(group.status, DONE)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:17,代码来源:ServiceGroupTest.py

示例10: test_skipped_group_dep_error

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例11: test_run_partial_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例12: test_prepare_group_with_errors_one

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例13: test_prepare_group_internal_external_deps

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [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

示例14: test_prepare_empty_group_reverse

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import run [as 别名]
 def test_prepare_empty_group_reverse(self):
     '''Test method prepare reverse with a single empty ServiceGroup.'''
     group = ServiceGroup('GROUP')
     group.algo_reversed = True
     group.run('start')
     self.assertEqual(group.status, MISSING)
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:8,代码来源:ServiceGroupTest.py


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