修复多次编译的时候的冲突问题

This commit is contained in:
virusdefender 2016-10-04 13:33:26 +08:00
parent e362434700
commit 15abb18267
2 changed files with 4 additions and 2 deletions

View File

@ -99,7 +99,7 @@ if __name__ == "__main__":
print client.compile_spj(src=c_spj_src, spj_version="1", spj_compile_config=c_lang_config["spj_compile"],
test_case_id="spj"), "\n\n"
print client.judge(src=c_src, language_config=c_lang_config, submission_id=str(int(time.time())),
print client.judge(src=c_src, language_config=c_lang_config, submission_id="0",
max_cpu_time=1000, max_memory=1024 * 1024 * 128,
test_case_id="normal"), "\n\n"

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import json
import os
import time
import _judger
@ -15,7 +16,7 @@ class Compiler(object):
command = compile_config["compile_command"]
exe_path = os.path.join(output_dir, compile_config["exe_name"])
command = command.format(src_path=src_path, exe_dir=output_dir, exe_path=exe_path)
compiler_out = os.path.join(output_dir, "compiler.out")
compiler_out = os.path.join(output_dir, str(time.time()) + "-compiler.out")
_command = command.split(" ")
result = _judger.run(max_cpu_time=compile_config["max_cpu_time"],
@ -43,4 +44,5 @@ class Compiler(object):
raise CompileError(error)
raise CompileError("Compiler runtime error, info: %s" % json.dumps(result).decode("utf-8"))
os.remove(compiler_out)
return exe_path