Пример #1
0
    def start_queue(self, run_context, job_queue):
        max_runtime = self._enkf_main().analysisConfig().get_max_runtime()
        if max_runtime == 0:
            max_runtime = None

        # submit jobs
        for i in range(len(run_context)):
            if not run_context.is_active(i):
                continue
            run_arg = run_context[i]
            self.add_job(run_arg,
                         self._enkf_main().resConfig(), job_queue, max_runtime)

        job_queue.submit_complete()
        queue_evaluators = None
        if (self._enkf_main().analysisConfig().get_stop_long_running()
                and self._enkf_main().analysisConfig(
                ).minimum_required_realizations > 0):
            queue_evaluators = [
                partial(
                    EnkfSimulationRunner.stop_long_running_jobs, job_queue,
                    self._enkf_main().analysisConfig().
                    minimum_required_realizations)
            ]

        jqm = JobQueueManager(job_queue, queue_evaluators)
        jqm.execute_queue()
Пример #2
0
    def start_queue(self, run_context, job_queue):
        max_runtime = self._enkf_main().analysisConfig().get_max_runtime()
        if max_runtime == 0:
            max_runtime = None

        done_callback_function = EnKFState.forward_model_ok_callback
        exit_callback_function = EnKFState.forward_model_exit_callback

        # submit jobs
        for index, run_arg in enumerate(run_context):
            if not run_context.is_active(index):
                continue
            job_queue.add_job_from_run_arg(
                run_arg,
                self._enkf_main().resConfig(),
                max_runtime,
                done_callback_function,
                exit_callback_function,
            )

        job_queue.submit_complete()
        queue_evaluators = None
        if (
            self._enkf_main().analysisConfig().get_stop_long_running()
            and self._enkf_main().analysisConfig().minimum_required_realizations > 0
        ):
            queue_evaluators = [
                partial(
                    job_queue.stop_long_running_jobs,
                    self._enkf_main().analysisConfig().minimum_required_realizations,
                )
            ]

        jqm = JobQueueManager(job_queue, queue_evaluators)
        jqm.execute_queue()
Пример #3
0
    def test_kill_queue(self):
        with TestAreaContext("job_queue_manager_test") as work_area:
            max_submit_num = 5
            job_queue = create_queue(simple_script, max_submit=max_submit_num)
            manager = JobQueueManager(job_queue)
            job_queue.kill_all_jobs()
            manager.execute_queue()

            for job in job_queue.job_list:
                assert job.status == JobStatusType.JOB_QUEUE_FAILED
Пример #4
0
    def test_execute_queue(self):

        with TestAreaContext("job_queue_manager_test") as work_area:
            job_queue = create_queue(simple_script)
            manager = JobQueueManager(job_queue)
            manager.execute_queue()

            self.assertFalse(job_queue.isRunning())

            for job in job_queue.job_list:
                ok_file = os.path.realpath(os.path.join(job.run_path, "OK"))
                assert os.path.isfile(ok_file)
                with open(ok_file, 'r') as f:
                    assert f.read() == "success"
Пример #5
0
    def test_max_submit_reached(self):
        with TestAreaContext("job_queue_manager_test") as work_area:
            max_submit_num = 5
            job_queue = create_queue(failing_script, max_submit=max_submit_num)
            manager = JobQueueManager(job_queue)
            manager.execute_queue()

            self.assertFalse(manager.isRunning())

            #check if it is really max_submit_num
            assert job_queue.max_submit == max_submit_num

            for job in job_queue.job_list:
                assert job.status == JobStatusType.JOB_QUEUE_FAILED
                assert job.submit_attempt == job_queue.max_submit
Пример #6
0
    def start_queue(self, run_context, job_queue):
        # submit jobs
        for i in range(len(run_context)):
            if not run_context.is_active(i):
                continue
            run_arg = run_context[i]
            self.add_job(run_arg, self._enkf_main().resConfig(), job_queue)
            

        job_queue.submit_complete()
        max_runtime = self._enkf_main().analysisConfig().get_max_runtime() 
        job_queue.set_max_job_duration(max_runtime)

        jqm = JobQueueManager(job_queue)
        jqm.execute_queue()