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


Python ExecutionEngineAgentClient.cleanup_process方法代碼示例

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


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

示例1: ExecutionEngineAgentPyonIntTest

# 需要導入模塊: from ion.agents.cei.execution_engine_agent import ExecutionEngineAgentClient [as 別名]
# 或者: from ion.agents.cei.execution_engine_agent.ExecutionEngineAgentClient import cleanup_process [as 別名]

#.........這裏部分代碼省略.........
                log.warn("Timeout calling EEAgent dump_state. retrying.")
                continue
            proc = get_proc_for_upid(state, upid)
            last_state = proc.get("state")
            if last_state == desired_state:
                return
            gevent.sleep(1)
            attempts += 1

        assert False, "Process %s took too long to get to %s, had %s" % (upid, desired_state, last_state)

    @needs_eeagent
    def test_basics(self):
        u_pid = "test0"
        round = 0
        run_type = "pyon"
        proc_name = "test_x"
        module = "ion.agents.cei.test.test_eeagent"
        cls = "TestProcess"
        parameters = {"name": proc_name, "module": module, "cls": cls}

        self.eea_client.launch_process(u_pid, round, run_type, parameters)
        self.wait_for_state(u_pid, [500, "RUNNING"])

        state = self.eea_client.dump_state().result
        assert len(state["processes"]) == 1

        self.eea_client.terminate_process(u_pid, round)
        self.wait_for_state(u_pid, [700, "TERMINATED"])

        state = self.eea_client.dump_state().result
        assert len(state["processes"]) == 1

        self.eea_client.cleanup_process(u_pid, round)
        state = self.eea_client.dump_state().result
        assert len(state["processes"]) == 0

    @needs_eeagent
    def test_restart(self):
        u_pid = "test0"
        round = 0
        run_type = "pyon"
        proc_name = "test_x"
        module = "ion.agents.cei.test.test_eeagent"
        cls = "TestProcess"
        parameters = {"name": proc_name, "module": module, "cls": cls}

        self.eea_client.launch_process(u_pid, round, run_type, parameters)
        self.wait_for_state(u_pid, [500, "RUNNING"])

        state = self.eea_client.dump_state().result
        assert len(state["processes"]) == 1

        # Start again with incremented round. eeagent should restart the process
        round += 1

        self.eea_client.launch_process(u_pid, round, run_type, parameters)
        self.wait_for_state(u_pid, [500, "RUNNING"])

        state = self.eea_client.dump_state().result
        ee_round = state["processes"][0]["round"]
        assert round == int(ee_round)

        # TODO: this test is disabled, as the restart op is disabled
        # Run restart with incremented round. eeagent should restart the process
        # round += 1
開發者ID:shenrie,項目名稱:coi-services,代碼行數:70,代碼來源:test_eeagent.py


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