本文整理汇总了Python中ambari_agent.ActionQueue.ActionQueue.run方法的典型用法代码示例。如果您正苦于以下问题:Python ActionQueue.run方法的具体用法?Python ActionQueue.run怎么用?Python ActionQueue.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ambari_agent.ActionQueue.ActionQueue
的用法示例。
在下文中一共展示了ActionQueue.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_status_command_without_globals_section
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import run [as 别名]
def test_status_command_without_globals_section(self, stopped_method,
read_stack_version_method):
config = AmbariConfig().getConfig()
config.set('agent', 'prefix', TestStackVersionsFileHandler.dummyVersionsFile)
queue = ActionQueue(config)
statusCommand = {
"serviceName" : 'HDFS',
"commandType" : "STATUS_COMMAND",
"clusterName" : "",
"componentName" : "DATANODE",
'configurations':{}
}
queue.stopped = stopped_method
stopped_method.side_effect = [False, False, True, True, True]
read_stack_version_method.return_value="1.3.0"
queue.IDLE_SLEEP_TIME = 0.001
queue.put(statusCommand)
queue.run()
returned_result = queue.resultQueue.get()
returned_result[1]['status'] = 'INSTALLED' # Patch live value
self.assertEquals(returned_result, ('STATUS_COMMAND',
{'clusterName': '',
'componentName': 'DATANODE',
'msg': '',
'serviceName': 'HDFS',
'stackVersion': '1.3.0',
'status': 'INSTALLED'}))
示例2: test_run_unrecognized_command
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import run [as 别名]
def test_run_unrecognized_command(self, logger_method, stopped_method):
config = AmbariConfig().getConfig()
actionQueue = ActionQueue(config)
command = {
"serviceName" : 'HDFS',
"commandType" : "SOME_UNRECOGNIZED_COMMAND",
"clusterName" : "",
"componentName" : "DATANODE",
'configurations':{}
}
actionQueue.commandQueue.put(command)
actionQueue.stopped = stopped_method
stopped_method.side_effect = [False, False, True, True, True]
actionQueue.IDLE_SLEEP_TIME = 0.001
actionQueue.run()
self.assertTrue(logger_method.call_args[0][0].startswith('Unrecognized command'))
示例3: test_upgradeCommand_dispatching
# 需要导入模块: from ambari_agent.ActionQueue import ActionQueue [as 别名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import run [as 别名]
def test_upgradeCommand_dispatching(self, stopped_method, executeCommand_method):
queue = ActionQueue(config = MagicMock())
command = {
'commandId': 17,
'role' : "role",
'taskId' : "taskId",
'clusterName' : "clusterName",
'serviceName' : "serviceName",
'roleCommand' : 'UPGRADE',
'hostname' : "localhost.localdomain",
'hostLevelParams': "hostLevelParams",
'clusterHostInfo': "clusterHostInfo",
'configurations': "configurations",
'commandType': "EXECUTION_COMMAND",
'configurations':{'global' : {}},
'roleParams': {},
'commandParams' : {
'source_stack_version' : 'HDP-1.2.1',
'target_stack_version' : 'HDP-1.3.0'
}
}
result = [{
'exitcode' : 0,
'stdout' : 'abc',
'stderr' : 'def'
}]
executeCommand_method.return_value = result
stopped_method.side_effect = [False, False, True, True, True]
queue.stopped = stopped_method
queue.IDLE_SLEEP_TIME = 0.001
queue.put(command)
queue.run()
self.assertTrue(executeCommand_method.called)
self.assertEquals(queue.resultQueue.qsize(), 1)
returned_result = queue.resultQueue.get()
self.assertTrue(returned_result[1] is result[0])