Exemplo n.º 1
0
    def __init__(self, agents, image_aliases, hook_manager=None, is_testing=False):
        """
            Starts the job manager.

            Arguments:

            :param agents:
                A list of dictionaries containing information about distant backend agents:
                ::

                    {
                        'host': "the host of the agent",
                        'port': "the port on which the agent listens"
                    }
            :param image_aliases: a dict of image aliases, like {"default": "ingi/inginious-c-default"}.
            :param hook_manager: An instance of HookManager. If no instance is given(None), a new one will be created.
        """

        AbstractJobManager.__init__(self, image_aliases, hook_manager, is_testing)
        self._agents = [None for _ in range(0, len(agents))]
        self._agents_thread = [None for _ in range(0, len(agents))]
        self._agents_info = agents

        self._next_agent = 0
        self._running_on_agent = [[] for _ in range(0, len(agents))]

        self._last_content_in_task_directory = None
Exemplo n.º 2
0
 def test_merge_text_global(self):
     res = AbstractJobManager._merge_results({"result": "success", "text": "a"}, {"result": "success", "text": "b"})
     assert res["text"] == "b\na"
Exemplo n.º 3
0
 def test_merge_text_problem(self):
     res = AbstractJobManager._merge_results({"result": "success", "problems": {"id": "a"}}, {"result": "success", "problems": {"id": "b"}})
     assert res["problems"]["id"] == "b\na"
Exemplo n.º 4
0
 def test_strange_result_types(self):
     res = AbstractJobManager._merge_results({"result": "success"}, {"result": "strange"})
     assert res["result"] == "error"
Exemplo n.º 5
0
 def test_std_out_err(self):
     res = AbstractJobManager._merge_results({"result": "success"}, {"result": "success", "stdout": "a", "stderr": "b"})
     assert res["stdout"] == "a"
     assert res["stderr"] == "b"
Exemplo n.º 6
0
 def test_non_float_grades(self):
     res = AbstractJobManager._merge_results({"result": "success", "grade": "You shall not grade!"}, None)
     assert res["grade"] == 0
Exemplo n.º 7
0
 def test_too_high_grades(self):
     res = AbstractJobManager._merge_results({"result": "success", "grade": 100000}, None)
     assert res["grade"] == 200
Exemplo n.º 8
0
 def test_neg_grades(self):
     res = AbstractJobManager._merge_results({"result": "success", "grade": -8}, None)
     assert res["grade"] == 0
Exemplo n.º 9
0
 def test_norun_merge_list(self):
     res = AbstractJobManager._merge_results({"result": "success", "problems": {"id1": ["a", "a"]}, "text": ["b", "b"]}, None)
     assert res["problems"]["id1"] == "a\na"
     assert res["text"] == "b\nb"
Exemplo n.º 10
0
 def _agent_batch_job_ended(self, jobid, result, agent_id=None):
     """ Custom _job_ended with more infos """
     if agent_id is not None:
         self._running_on_agent[agent_id].remove(jobid)
     AbstractJobManager._batch_job_ended(self, jobid, result)