增加了题目的 model 修改几个 typo
This commit is contained in:
@@ -8,7 +8,7 @@ from settings import max_running_number, lrun_gid, lrun_uid, judger_workspace
|
||||
from language import languages
|
||||
from result import result
|
||||
from compiler import compile_
|
||||
from judge_exceptions import JudgeClientException, CompileError
|
||||
from judge_exceptions import JudgeClientError, CompileError
|
||||
from utils import parse_lrun_output
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ class JudgeClient(object):
|
||||
f = open(self._test_case_dir + "info")
|
||||
return json.loads(f.read())
|
||||
except IOError:
|
||||
raise JudgeClientException("Test case config file not found")
|
||||
raise JudgeClientError("Test case config file not found")
|
||||
except ValueError:
|
||||
raise JudgeClientException("Test case config file format error")
|
||||
raise JudgeClientError("Test case config file format error")
|
||||
|
||||
def _generate_command(self, test_case_id):
|
||||
"""
|
||||
@@ -82,7 +82,7 @@ class JudgeClient(object):
|
||||
# 倒序找到MEMORY的位置
|
||||
output_start = output.rfind("MEMORY")
|
||||
if output_start == -1:
|
||||
raise JudgeClientException("Lrun result parse error")
|
||||
raise JudgeClientError("Lrun result parse error")
|
||||
# 如果不是0,说明lrun输出前面有输出,也就是程序的stderr有内容
|
||||
if output_start != 0:
|
||||
error = output[0:output_start]
|
||||
@@ -118,7 +118,7 @@ class JudgeClient(object):
|
||||
command = self._generate_command(test_case_id)
|
||||
status_code, output = commands.getstatusoutput(command)
|
||||
if status_code:
|
||||
raise JudgeClientException(output)
|
||||
raise JudgeClientError(output)
|
||||
error, run_result = self._parse_lrun_output(output)
|
||||
|
||||
run_result["test_case_id"] = test_case_id
|
||||
@@ -135,7 +135,7 @@ class JudgeClient(object):
|
||||
elif run_result["exceed"] in ["cpu_time", "real_time"]:
|
||||
run_result["result"] = result["time_limit_exceeded"]
|
||||
else:
|
||||
raise JudgeClientException("Error exceeded type: " + run_result["exceed"])
|
||||
raise JudgeClientError("Error exceeded type: " + run_result["exceed"])
|
||||
return run_result
|
||||
|
||||
# 下面就是代码正常运行了 需要判断代码的输出是否正确
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import commands
|
||||
|
||||
from settings import lrun_uid, lrun_gid
|
||||
from judge_exceptions import CompileError
|
||||
from judge_exceptions import CompileError, JudgeClientError
|
||||
from utils import parse_lrun_output
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ def compile_(language_item, src_path, exe_path):
|
||||
output_start = output.rfind("MEMORY")
|
||||
|
||||
if output_start == -1:
|
||||
raise CompileError("Error running compiler in lrun")
|
||||
raise JudgeClientError("Error running compiler in lrun")
|
||||
|
||||
# 返回值不为0 或者 stderr中lrun的输出之前有东西
|
||||
if status or output_start:
|
||||
@@ -33,5 +33,4 @@ def compile_(language_item, src_path, exe_path):
|
||||
if parse_result["exit_code"] or parse_result["term_sig"] or parse_result["siginaled"] or parse_result["exceed"]:
|
||||
raise CompileError("Compile error")
|
||||
|
||||
# 对于正常编译和超时等其他的错误
|
||||
return exe_path
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# coding=utf-8
|
||||
|
||||
|
||||
class JudgeClientException(Exception):
|
||||
class JudgeClientError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CompileError(Exception):
|
||||
pass
|
||||
pass
|
||||
Reference in New Issue
Block a user