增加部分logger配置

This commit is contained in:
virusdefender 2016-04-07 16:19:39 +08:00
parent b3116cc430
commit 90801f7f7e
2 changed files with 4 additions and 5 deletions

View File

@ -1,10 +1,8 @@
# coding=utf-8 # coding=utf-8
import time
import os import os
import judger import judger
from judge_exceptions import CompileError, JudgeClientError from judge_exceptions import CompileError
from logger import logger from logger import logger
from settings import judger_workspace
def compile_(language_item, src_path, exe_path, judge_base_path, compile_spj=False): def compile_(language_item, src_path, exe_path, judge_base_path, compile_spj=False):

View File

@ -3,6 +3,7 @@ import os
import socket import socket
import shutil import shutil
from logger import logger
from client import JudgeClient from client import JudgeClient
from language import languages from language import languages
from compiler import compile_ from compiler import compile_
@ -19,6 +20,8 @@ class JudgeInstanceRunner(object):
judge_base_path = os.path.join(judger_workspace, "run", submission_id) judge_base_path = os.path.join(judger_workspace, "run", submission_id)
if not token or token != os.environ.get("rpc_token"): if not token or token != os.environ.get("rpc_token"):
if token:
logger.info("Invalid token: " + token)
return {"code": 2, "data": {"error": "Invalid token", "server": host_name}} return {"code": 2, "data": {"error": "Invalid token", "server": host_name}}
try: try:
@ -78,8 +81,6 @@ class JudgeInstanceRunner(object):
for item in judge_result["info"]: for item in judge_result["info"]:
if item["result"] != 0: if item["result"] != 0:
judge_result["result"] = item["result"] judge_result["result"] = item["result"]
if item.get("error"):
judge_result["info"] = item["error"]
break break
else: else:
l = sorted(judge_result["info"], key=lambda k: k["cpu_time"]) l = sorted(judge_result["info"], key=lambda k: k["cpu_time"])