mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2024-12-28 21:31:43 +00:00
加强对special judge的判断
This commit is contained in:
parent
15abb18267
commit
c97b57e95a
@ -38,6 +38,10 @@ class JudgeClient(object):
|
||||
|
||||
self._spj_version = spj_version
|
||||
self._spj_config = spj_config
|
||||
if self._spj_version and self._spj_config:
|
||||
self._spj_exe = os.path.join(self._test_case_dir, self._spj_config["exe_name"].format(spj_version=self._spj_version))
|
||||
if not os.path.exists(self._spj_exe):
|
||||
raise JudgeClientError("spj exe not found")
|
||||
|
||||
def _load_test_case_info(self):
|
||||
try:
|
||||
@ -62,9 +66,9 @@ class JudgeClient(object):
|
||||
return output_md5, output_md5 == self._test_case_info["test_cases"][str(test_case_file_id)]["striped_output_md5"]
|
||||
|
||||
def _spj(self, in_file_path, user_out_file_path):
|
||||
command = self._spj_config["command"].format(exe_path=os.path.join(self._test_case_dir,
|
||||
self._spj_config["exe_name"].format(spj_version=self._spj_version)),
|
||||
in_file_path=in_file_path, user_out_file_path=user_out_file_path).split(" ")
|
||||
command = self._spj_config["command"].format(exe_path=self._spj_exe,
|
||||
in_file_path=in_file_path,
|
||||
user_out_file_path=user_out_file_path).split(" ")
|
||||
result = _judger.run(max_cpu_time=self._max_cpu_time * 3,
|
||||
max_real_time=self._max_cpu_time * 9,
|
||||
max_memory=self._max_memory * 3,
|
||||
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
import hashlib
|
||||
|
||||
from exception import JudgeServiceError
|
||||
from utils import server_info, get_token, logger
|
||||
@ -29,7 +30,7 @@ class JudgeService(object):
|
||||
def _request(self, data):
|
||||
try:
|
||||
r = requests.post(self.service_discovery_url, data=json.dumps(data),
|
||||
headers={"X-JUDGE-SERVER-TOKEN": get_token()}, timeout=5).json()
|
||||
headers={"X-JUDGE-SERVER-TOKEN": hashlib.sha256(get_token()).hexdigest()}, timeout=5).json()
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
raise JudgeServiceError(e.message)
|
||||
|
Loading…
Reference in New Issue
Block a user