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


Python ServiceGroup.resolve_all方法代码示例

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


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

示例1: test_resolve_all_with_full_config

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import resolve_all [as 别名]
    def test_resolve_all_with_full_config(self):
        """Test instantiation of a service group with variables subservices."""
        sergrp = ServiceGroup('S1')
        sergrp.add_var('TOUT', 1)
        sergrp.add_var('RET', 2)
        sergrp.add_var('FAN', 3)
        sergrp.add_var('DLY', 4)
        sergrp.add_var('ERRS', 0)
        sergrp.add_var('WARN', 5)
        sergrp.add_var('DSC', 'I am the service')
        sergrp.add_var('MD', 'delegate')
        sergrp.add_var('REQUIRES', ["dep1", "dep2"])

        sergrp.fromdict({
                    'desc':   "Check variables",
                    'target': "localhost",
                    'services': {
                        'dep1':
                            {'actions': {'start': {'cmd': '/bin/True'}} },
                        'dep2':
                            {'actions': {'start': {'cmd': '/bin/True'}} },
                        'fullvars': {
                                     'target': 'localhost',
                                     'require': "%REQUIRES",
                                     'timeout': "%TOUT",
                                     'retry': "%RET",
                                     'fanout': "%FAN",
                                     'delay': "%DLY",
                                     'errors': "%ERRS",
                                     'warnings': "%WARN",
                                     'mode': "%MD",
                                     'actions': {
                                                 'start': {'cmd': '/bin/True'},
                                                 'stop':  {'cmd': '/bin/False'}
                                                },
                                     'desc': "%DSC"
                                    }
                         },
                    })
        sergrp.resolve_all()
        service = sergrp._subservices['fullvars']
        self.assertEqual(service.target, NodeSet('localhost'))
        self.assertEqual(service.timeout, 1)
        self.assertEqual(service.maxretry, 2)
        self.assertEqual(service.fanout, 3)
        self.assertEqual(service.delay, 4)
        self.assertEqual(service.errors, 0)
        self.assertEqual(service.warnings, 5)
        self.assertEqual(service.mode, 'delegate')
        self.assertEqual(service.desc, "I am the service")
        self.assertTrue('dep1' in service.deps())
        self.assertTrue('dep2' in service.deps())
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:54,代码来源:ServiceGroupTest.py

示例2: test_resolve_all_local_variable

# 需要导入模块: from MilkCheck.Engine.ServiceGroup import ServiceGroup [as 别名]
# 或者: from MilkCheck.Engine.ServiceGroup.ServiceGroup import resolve_all [as 别名]
 def test_resolve_all_local_variable(self):
     """Variable resolution in 'require' with a local variable."""
     svcgrp = ServiceGroup('group')
     svcgrp.fromdict({
                     'services': {
                         'dep1': {
                                  'actions': {'start': {'cmd': '/bin/True'}}
                         },
                         'dep2': {
                                  'variables': {'foo': ['dep1']},
                                  'require': "%foo",
                                  'actions': {'start': {'cmd': '/bin/True'}}
                         },
                     }
                     })
     svcgrp.resolve_all()
     service = svcgrp._subservices['dep2']
     self.assertTrue('dep1' in service.deps())
开发者ID:cea-hpc,项目名称:milkcheck,代码行数:20,代码来源:ServiceGroupTest.py


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