def generate_base_environ(self, environ, submission, **kwargs): contest = submission.problem_instance.contest self.generate_initial_evaluation_environ(environ, submission) environ.setdefault('recipe', []).extend([ ('compile', 'oioioi.programs.handlers.compile'), ('compile_end', 'oioioi.programs.handlers.compile_end'), recipe_placeholder('after_compile'), ('delete_executable', 'oioioi.programs.handlers.delete_executable'), ]) environ.setdefault('error_handlers', []).append(( 'delete_executable', 'oioioi.programs.handlers.delete_executable')) if getattr(settings, 'USE_UNSAFE_EXEC', False): environ['exec_mode'] = 'unsafe' else: environ['exec_mode'] = \ submission.problem_instance.controller.get_safe_exec_mode() environ['untrusted_checker'] = not settings.USE_UNSAFE_CHECKER if getattr(settings, 'USE_LOCAL_COMPILERS', False): environ['compiler'] = 'system-' + environ['language']
def generate_recipe(self, kinds): recipe_body = [ ('collect_tests', 'oioioi.programs.handlers.collect_tests'), ] if 'INITIAL' in kinds: recipe_body.extend([ ('initial_run_tests', 'oioioi.programs.handlers.run_tests', dict(kind='EXAMPLE')), ('initial_run_tests_end', 'oioioi.programs.handlers.run_tests_end'), ('initial_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('initial_grade_groups', 'oioioi.programs.handlers.grade_groups'), ('initial_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind='EXAMPLE')), ('initial_make_report', 'oioioi.programs.handlers.make_report', dict(kind='INITIAL')), recipe_placeholder('after_initial_tests'), ]) if 'USER_OUTS' in kinds: recipe_body.extend([ ('userout_run_tests', 'oioioi.programs.handlers.run_tests', dict(kind=None)), ('userout_run_tests', 'oioioi.programs.handlers.run_tests_end'), ('userout_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('userout_grade_groups', 'oioioi.programs.handlers.grade_groups'), ('userout_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind=None)), ('userout_make_report', 'oioioi.programs.handlers.make_report', dict(kind='USER_OUTS', save_scores=False)), ('userout_fill_outfile_in_existing_test_reports', 'oioioi.programs.handlers.' 'fill_outfile_in_existing_test_reports'), ('userout_insert_existing_submission_link', 'oioioi.programs.handlers.' 'insert_existing_submission_link'), ]) if 'NORMAL' in kinds or 'HIDDEN' in kinds or 'FULL' in kinds: recipe_body.append(recipe_placeholder('before_final_tests')) if 'NORMAL' in kinds: recipe_body.extend([ ('final_run_tests', 'oioioi.programs.handlers.run_tests', dict(kind='NORMAL')), ('final_run_tests_end', 'oioioi.programs.handlers.run_tests_end'), ('final_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('final_grade_groups', 'oioioi.programs.handlers.grade_groups'), ('final_grade_submission', 'oioioi.programs.handlers.grade_submission'), ('final_make_report', 'oioioi.programs.handlers.make_report'), recipe_placeholder('after_final_tests'), ]) if 'HIDDEN' in kinds: recipe_body.extend([ ('hidden_run_tests', 'oioioi.programs.handlers.run_tests'), ('hidden_run_tests_end', 'oioioi.programs.handlers.run_tests_end'), ('hidden_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('hidden_grade_groups', 'oioioi.programs.handlers.grade_groups'), ('hidden_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind=None)), ('hidden_make_report', 'oioioi.programs.handlers.make_report', dict(kind='HIDDEN')), recipe_placeholder('after_all_tests'), ]) if 'FULL' in kinds: recipe_body.extend([ ('full_run_tests', 'oioioi.programs.handlers.run_tests'), ('full_run_tests', 'oioioi.programs.handlers.run_tests_end'), ('full_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('full_grade_groups', 'oioioi.programs.handlers.grade_groups'), ('full_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind=None)), ('full_make_report', 'oioioi.programs.handlers.make_report', dict(kind='FULL')), recipe_placeholder('after_full_tests'), ]) return recipe_body
def generate_recipe(self, kinds): recipe_body = [] # NOTE this will do nothing if the contest type is ACM # and kinds=['FULL'] if 'INITIAL' in kinds: recipe_body.extend([ recipe_placeholder('before_initial_tests'), ( 'initial_submit_job', 'oioioi.zeus.handlers.submit_job', dict(kind='INITIAL'), ), ('initial_import_results', 'oioioi.zeus.handlers.import_results'), ( 'initial_update_tests_set', 'oioioi.zeus.handlers.update_problem_tests_set', dict(kind='EXAMPLE'), ), ('initial_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('initial_grade_groups', 'oioioi.programs.handlers.grade_groups'), ( 'initial_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind='EXAMPLE'), ), ( 'initial_make_report', 'oioioi.programs.handlers.make_report', dict(kind='INITIAL'), ), recipe_placeholder('after_initial_tests'), ]) if 'NORMAL' in kinds: recipe_body.extend([ recipe_placeholder('before_final_tests'), ( 'final_submit_job', 'oioioi.zeus.handlers.submit_job', dict(kind='NORMAL'), ), ('final_import_results', 'oioioi.zeus.handlers.import_results'), ( 'final_update_tests_set', 'oioioi.zeus.handlers.update_problem_tests_set', dict(kind='NORMAL'), ), ('final_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('final_grade_groups', 'oioioi.programs.handlers.grade_groups'), ( 'final_grade_submission', 'oioioi.programs.handlers.grade_submission', ), ('final_make_report', 'oioioi.programs.handlers.make_report'), recipe_placeholder('after_final_tests'), ]) if 'HIDDEN' in kinds: recipe_body.extend([ recipe_placeholder('before_initial_tests'), ( 'initial_submit_job', 'oioioi.zeus.handlers.submit_job', dict(kind='INITIAL'), ), recipe_placeholder('before_final_tests'), ( 'final_submit_job', 'oioioi.zeus.handlers.submit_job', dict(kind='NORMAL'), ), ('import_results', 'oioioi.zeus.handlers.import_results'), ( 'initial_update_tests_set', 'oioioi.zeus.handlers.update_problem_tests_set', dict(kind='EXAMPLE'), ), ( 'final_update_tests_set', 'oioioi.zeus.handlers.update_problem_tests_set', dict(kind='NORMAL'), ), ('hidden_grade_tests', 'oioioi.programs.handlers.grade_tests'), ('hidden_grade_groups', 'oioioi.programs.handlers.grade_groups'), ( 'hidden_grade_submission', 'oioioi.programs.handlers.grade_submission', dict(kind=None), ), ( 'hidden_make_report', 'oioioi.programs.handlers.make_report', dict(kind='HIDDEN'), ), recipe_placeholder('after_all_tests'), ]) return recipe_body