修改部分命名风格
This commit is contained in:
@@ -3,9 +3,11 @@ from __future__ import absolute_import
|
||||
from judge.controller.celery import app
|
||||
import subprocess32 as subprocess
|
||||
|
||||
subprocess.call("ping baidu.com", timeout=5)
|
||||
|
||||
|
||||
@app.task
|
||||
def judge(source_code, language, test_case_id):
|
||||
pass
|
||||
def judge(solution_id, time_limit, memory_limit, test_case_id):
|
||||
subprocess.call("/usr/bin/docker run -t -i --privileged -v /var/test_case/:/var/judger/test_case/ "
|
||||
"-v /var/code/:/var/judger/code/ judger python judge/judger/run.py "
|
||||
"--solution_id %s --time_limit %s --memory_limit %s --test_case_id %s" %
|
||||
(solution_id, str(time_limit), str(memory_limit), test_case_id),
|
||||
timeout=(time_limit / 100) * 20)
|
||||
|
||||
@@ -13,12 +13,12 @@ from settings import judger_workspace
|
||||
from oj import settings
|
||||
|
||||
# 简单的解析命令行参数
|
||||
# 参数有 -solution_id -max_cpu_time -max_memory -test_case_id
|
||||
# 获取到的值是['xxx.py', '-solution_id', '1111', '-max_cpu_time', '1000', '-max_memory', '100', '-test_case_id', 'aaaa']
|
||||
# 参数有 -solution_id -time_limit -memory_limit -test_case_id
|
||||
# 获取到的值是['xxx.py', '-solution_id', '1111', '-time_limit', '1000', '-memory_limit', '100', '-test_case_id', 'aaaa']
|
||||
args = sys.argv
|
||||
solution_id = args[2]
|
||||
max_cpu_time = args[4]
|
||||
max_memory = args[6]
|
||||
time_limit = args[4]
|
||||
memory_limit = args[6]
|
||||
test_case_id = args[8]
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ except Exception as e:
|
||||
|
||||
client = JudgeClient(language_code=language,
|
||||
exe_path=exe_path,
|
||||
max_cpu_time=1000000,
|
||||
max_real_time=200000,
|
||||
max_memory=1000,
|
||||
max_cpu_time=int(time_limit),
|
||||
max_real_time=int(time_limit) * 2,
|
||||
max_memory=int(memory_limit),
|
||||
test_case_dir="/var/judger/test_case/" + str(test_case_id) + "/")
|
||||
print client.run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user