本文整理汇总了Python中pyon.util.containers.DotDict.state方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.state方法的具体用法?Python DotDict.state怎么用?Python DotDict.state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.util.containers.DotDict
的用法示例。
在下文中一共展示了DotDict.state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from pyon.util.containers import DotDict [as 别名]
# 或者: from pyon.util.containers.DotDict import state [as 别名]
def setUp(self):
try:
from epu.highavailability.core import HighAvailabilityCore # noqa
except ImportError:
raise SkipTest("HA Core not available. Run buildout with autolaunch.cfg")
self.ha_agent = HighAvailabilityAgent()
self.ha_agent.container = DotDict()
self.ha_agent.CFG = DotDict()
self.ha_agent.CFG.highavailability = DotDict()
self.ha_agent.CFG.highavailability.policy = DotDict()
self.ha_agent.CFG.highavailability.policy.name = 'npreserving'
self.ha_agent.CFG.highavailability.policy.interval = 1
self.ha_agent.CFG.highavailability.policy.parameters = {'preserve_n': 0}
self.ha_agent.CFG.highavailability.process_definition_id = 'myprocdef'
service_id = 'ha_agent'
definition_name = 'mydef'
self.ha_agent._register_service = Mock(return_value=(service_id, definition_name))
self.ha_agent.container['resource_registry'] = Mock()
service = DotDict()
service.state = 'state'
service.policy = {}
self.ha_agent.container.resource_registry.read = Mock(return_value=service)
self.ha_agent.container.resource_registry.update = Mock()
with patch('ion.agents.cei.high_availability_agent.ProcessDispatcherServiceClient') as pd_client:
pd_client.read_process_definition.return_value = Mock()
self.ha_agent.init()
self.ha_agent.control = Mock()
self.ha_agent.control.get_all_processes = Mock(return_value={})
self.ha_agent.control.reload_processes = Mock()
self.ha_agent.core.control = self.ha_agent.control
self.policy_thread = gevent.spawn(self.ha_agent._policy_thread_loop)
self.threads = [self.policy_thread]