Exemplo n.º 1
0
 def setUp_job_manager(self):
     self.job_manager = LocalJobManager(
         {"default": "inginious-c-default"},
         os.path.join(os.path.dirname(__file__), 'tasks'),
         self.course_factory,
         self.task_factory,
         hook_manager=self.generate_hook_manager(),
         agent_class=get_fake_local_agent(self.handle_job_func))
     self.job_manager.start()
Exemplo n.º 2
0
class TestLocalJobManager(TestJobManager):
    def setUp_job_manager(self):
        self.job_manager = LocalJobManager({"default": "inginious-c-default"},
                                           os.path.join(os.path.dirname(__file__), 'tasks'),
                                           self.course_factory,
                                           self.task_factory,
                                           hook_manager=self.generate_hook_manager(),
                                           agent_class=get_fake_local_agent(self.handle_job_func))
        self.job_manager.start()

    def generate_hook_manager(self):
        return None

    @abstractmethod
    def handle_job_func(self, job_id, course_id, task_id, inputdata, debug, callback_status):
        pass
Exemplo n.º 3
0
 def setUp_job_manager(self):
     self.job_manager = LocalJobManager({"default": "inginious-c-default"},
                                        os.path.join(os.path.dirname(__file__), 'tasks'),
                                        self.course_factory,
                                        self.task_factory,
                                        hook_manager=self.generate_hook_manager(),
                                        agent_class=get_fake_local_agent(self.handle_job_func))
     self.job_manager.start()
Exemplo n.º 4
0
class TestLocalJobManager(TestJobManager):
    def setUp_job_manager(self):
        self.job_manager = LocalJobManager(
            {"default": "inginious-c-default"},
            os.path.join(os.path.dirname(__file__), 'tasks'),
            self.course_factory,
            self.task_factory,
            hook_manager=self.generate_hook_manager(),
            agent_class=get_fake_local_agent(self.handle_job_func))
        self.job_manager.start()

    def generate_hook_manager(self):
        return None

    @abstractmethod
    def handle_job_func(self, job_id, course_id, task_id, inputdata, debug,
                        callback_status):
        pass
Exemplo n.º 5
0
def create_job_manager(configuration,
                       plugin_manager,
                       task_directory,
                       course_factory,
                       task_factory,
                       is_testing=False):
    """ Creates a new inginious.backend job manager from the configuration """

    # Create the job manager
    backend_type = configuration.get("backend", "local")
    if backend_type == "local":
        return LocalJobManager(
            configuration.get(
                'containers', {
                    "default": "ingi/inginious-c-default",
                    "sekexe": "ingi/inginious-c-sekexe"
                }), task_directory, course_factory, task_factory,
            configuration.get('local_agent_tmp_dir', "/tmp/inginious_agent"),
            plugin_manager, is_testing)
    elif backend_type == "remote":
        return RemoteDockerJobManager(
            configuration.get("docker_daemons", []),
            configuration.get(
                'containers', {
                    "default": "ingi/inginious-c-default",
                    "sekexe": "ingi/inginious-c-sekexe"
                }), task_directory, course_factory, task_factory,
            plugin_manager, is_testing)
    elif backend_type == "remote_manual":
        return RemoteManualAgentJobManager(
            configuration.get("agents", [{
                "host": "localhost",
                "port": 5001
            }]),
            configuration.get(
                'containers', {
                    "default": "ingi/inginious-c-default",
                    "sekexe": "ingi/inginious-c-sekexe"
                }), task_directory, course_factory, task_factory,
            plugin_manager, is_testing)
    elif backend_type == "docker_machine":
        return DockerMachineJobManager(
            configuration.get("machines", []),
            configuration.get(
                'containers', {
                    "default": "ingi/inginious-c-default",
                    "sekexe": "ingi/inginious-c-sekexe"
                }), task_directory, course_factory, task_factory,
            plugin_manager, is_testing)
    else:
        raise Exception("Unknown inginious.backend {}".format(backend_type))