當前位置: 首頁>>代碼示例>>Python>>正文


Python ActionQueue.stopped方法代碼示例

本文整理匯總了Python中ambari_agent.ActionQueue.ActionQueue.stopped方法的典型用法代碼示例。如果您正苦於以下問題:Python ActionQueue.stopped方法的具體用法?Python ActionQueue.stopped怎麽用?Python ActionQueue.stopped使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ambari_agent.ActionQueue.ActionQueue的用法示例。


在下文中一共展示了ActionQueue.stopped方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ActionQueueStartStop

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [as 別名]
 def test_ActionQueueStartStop(self):
   actionQueue = ActionQueue(AmbariConfig().getConfig())
   actionQueue.IDLE_SLEEP_TIME = 0.01
   actionQueue.start()
   actionQueue.stop()
   actionQueue.join()
   self.assertEqual(actionQueue.stopped(), True, 'Action queue is not stopped.')
開發者ID:adamosloizou,項目名稱:fiware-cosmos-ambari,代碼行數:9,代碼來源:TestActionQueue.py

示例2: test_status_command_without_globals_section

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [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'}))
開發者ID:adamosloizou,項目名稱:fiware-cosmos-ambari,代碼行數:29,代碼來源:TestActionQueue.py

示例3: test_ActionQueueStartStop

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [as 別名]
 def test_ActionQueueStartStop(self, CustomServiceOrchestrator_mock,
                               get_mock, process_command_mock):
   CustomServiceOrchestrator_mock.return_value = None
   dummy_controller = MagicMock()
   config = MagicMock()
   actionQueue = ActionQueue(config, dummy_controller)
   actionQueue.start()
   time.sleep(0.1)
   actionQueue.stop()
   actionQueue.join()
   self.assertEqual(actionQueue.stopped(), True, 'Action queue is not stopped.')
   self.assertTrue(process_command_mock.call_count > 1)
開發者ID:wbear2,項目名稱:ambari,代碼行數:14,代碼來源:TestActionQueue.py

示例4: test_cancel

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [as 別名]
 def test_cancel(self, CustomServiceOrchestrator_mock,
                      get_mock, process_command_mock):
   CustomServiceOrchestrator_mock.return_value = None
   dummy_controller = MagicMock()
   config = MagicMock()
   actionQueue = ActionQueue(config, dummy_controller)
   actionQueue.start()
   actionQueue.put([self.datanode_install_command, self.hbase_install_command])
   self.assertEqual(2, actionQueue.commandQueue.qsize())
   actionQueue.reset()
   self.assertTrue(actionQueue.commandQueue.empty())
   time.sleep(0.1)
   actionQueue.stop()
   actionQueue.join()
   self.assertEqual(actionQueue.stopped(), True, 'Action queue is not stopped.')
開發者ID:duxia,項目名稱:ambari,代碼行數:17,代碼來源:TestActionQueue.py

示例5: test_run_unrecognized_command

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [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'))
開發者ID:adamosloizou,項目名稱:fiware-cosmos-ambari,代碼行數:18,代碼來源:TestActionQueue.py

示例6: test_parallel_exec

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [as 別名]
 def test_parallel_exec(self, CustomServiceOrchestrator_mock,
                        process_command_mock, gpeo_mock):
   CustomServiceOrchestrator_mock.return_value = None
   dummy_controller = MagicMock()
   config = MagicMock()
   gpeo_mock.return_value = 1
   config.get_parallel_exec_option = gpeo_mock
   actionQueue = ActionQueue(config, dummy_controller)
   actionQueue.put([self.datanode_install_command, self.hbase_install_command])
   self.assertEqual(2, actionQueue.commandQueue.qsize())
   actionQueue.start()
   time.sleep(1)
   actionQueue.stop()
   actionQueue.join()
   self.assertEqual(actionQueue.stopped(), True, 'Action queue is not stopped.')
   self.assertEqual(2, process_command_mock.call_count)
   process_command_mock.assert_any_calls([call(self.datanode_install_command), call(self.hbase_install_command)])
開發者ID:OpenPOWER-BigData,項目名稱:HDP-ambari,代碼行數:19,代碼來源:TestActionQueue.py

示例7: test_reset_queue

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [as 別名]
 def test_reset_queue(self, CustomServiceOrchestrator_mock,
                               get_mock, process_command_mock, gpeo_mock):
   CustomServiceOrchestrator_mock.return_value = None
   dummy_controller = MagicMock()
   dummy_controller.recovery_manager = RecoveryManager(tempfile.mktemp())
   config = MagicMock()
   gpeo_mock.return_value = 0
   config.get_parallel_exec_option = gpeo_mock
   actionQueue = ActionQueue(config, dummy_controller)
   actionQueue.start()
   actionQueue.put([self.datanode_install_command, self.hbase_install_command])
   self.assertEqual(2, actionQueue.commandQueue.qsize())
   self.assertTrue(actionQueue.tasks_in_progress_or_pending())
   actionQueue.reset()
   self.assertTrue(actionQueue.commandQueue.empty())
   self.assertFalse(actionQueue.tasks_in_progress_or_pending())
   time.sleep(0.1)
   actionQueue.stop()
   actionQueue.join()
   self.assertEqual(actionQueue.stopped(), True, 'Action queue is not stopped.')
開發者ID:OpenPOWER-BigData,項目名稱:HDP-ambari,代碼行數:22,代碼來源:TestActionQueue.py

示例8: test_upgradeCommand_dispatching

# 需要導入模塊: from ambari_agent.ActionQueue import ActionQueue [as 別名]
# 或者: from ambari_agent.ActionQueue.ActionQueue import stopped [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])
開發者ID:adamosloizou,項目名稱:fiware-cosmos-ambari,代碼行數:38,代碼來源:TestActionQueue.py


注:本文中的ambari_agent.ActionQueue.ActionQueue.stopped方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。