判题暂时可以跑起来了,真要被自己蠢哭了

This commit is contained in:
virusdefender
2015-08-12 19:55:41 +08:00
parent 92ab7e5fb2
commit 66d3cd3bfe
13 changed files with 43 additions and 31 deletions

View File

@@ -8,13 +8,13 @@ import subprocess32 as subprocess
def judge(solution_id, time_limit, memory_limit, test_case_id):
try:
subprocess.call("docker run -t -i --privileged --rm=true "
"-v /var/test_case/:/var/judger/test_case/ "
"-v /Users/virusdefender/Desktop/test_case/:/var/judger/test_case/ "
"-v /Users/virusdefender/Desktop/:/var/judger/code/ "
"-p 27017:27017 "
"judger "
"python 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, shell=True)
# 如果设置的最长运行时间小于1000毫秒那么/1000就是0处理一下这个情况设置为两秒
timeout=(time_limit / 1000 * 3) or 2, shell=True)
except subprocess.TimeoutExpired:
print "docker timeout"