diff --git a/src/judgesystem/src/worker/judgers/programmingJudger/programmingJudger.py b/src/judgesystem/src/worker/judgers/programmingJudger/programmingJudger.py index 02f453e..c97b5b6 100644 --- a/src/judgesystem/src/worker/judgers/programmingJudger/programmingJudger.py +++ b/src/judgesystem/src/worker/judgers/programmingJudger/programmingJudger.py @@ -1,7 +1,10 @@ from src.shareddata.shareddata import g_config from src.worker.judgers.baseJudger import Judger from src.worker.judgers.ProgrammingJudger.checkers import * + + class ProgrammingJudger(Judger): + def __init__(self, t_tag, t_sandbox): """ @detail @@ -10,11 +13,11 @@ def __init__(self, t_tag, t_sandbox): """ Judger.__init__(self, t_tag) self.m_sandbox = t_sandbox - self.m_checkers = {0:compileChecker.CompileChecker("compile check", t_sandbox),\ - 1:staticChecker.StaticChecker("static check", t_sandbox)\ - 2:standardChecker.StandardChecker("standard tests", t_sandbox)\ - 3:randomChecker.RandomChecker("random tests", t_sandbox)\ - 4:memoryChecker.MemoryChecker("memory check", t_sandbox)\ + self.m_checkers = {0: compileChecker.CompileChecker("compile check", t_sandbox), + 1: staticChecker.StaticChecker("static check", t_sandbox), + 2: standardChecker.StandardChecker("standard tests", t_sandbox), + 3: randomChecker.RandomChecker("random tests", t_sandbox), + 4: memoryChecker.MemoryChecker("memory check", t_sandbox) } def judger(self, submission): @@ -22,7 +25,7 @@ def judger(self, submission): @param submission is the detail of a student submission, @structure is as: - {"submission_id":s_id, "submission_problem_id":p_id, + {"submission_id":s_id, "problem_id":p_id, "problem_type":p_type, "submission_type":s_type, "submission_problem_config":config} @detail @@ -30,17 +33,17 @@ def judger(self, submission): submission_problem_id: the id of problem corresponding to current sub problem_type: choice or programming submission_type:student submission or teacher design a problem - submission_config: the config of submission + submission_problem_config: the config of submission """ submission_id = submission["submission_id"] problem_id = submission["problem_id"] - config = submission["submission_config"] - #ret is used to store the judge result + config = submission["submission_problem_config"] + # ret is used to store the judge result ret["total_grade"] = 0 ret["submission_id"] = submission_id - #if missing submission dependency, write the report and return - if not (checke_submission_legal(submission_id, problem_id)): + # if missing submission dependency, write the report and return + if not (check_submission_legal(submission_id, problem_id)): ret["error"] = "missing submission dependency" ret["write_grade"] = 1 self.write_result_to_database(submission_id, ret, True) @@ -53,7 +56,7 @@ def judger(self, submission): g_logger.info("[Judger Programming] start to check submission id = " + \ str(submission_id)) for index in xrange(0, 5): - #continue when this stage not in the config + # continue when this stage not in the config if self.m_checkers[index].getTag() not in config["grading"]: continue @@ -71,7 +74,7 @@ def judger(self, submission): self.write_result_to_database(submission_id, ret, True) @staticmethod - def checke_submission_legal(submission_id, problem_id): + def check_submission_legal(submission_id, problem_id): """ checker submission and standard files exists or not, if missing some of them, return False, else True