def evaluate_output(task_name, input_path, output_path):
"""
Given an input of a task, evaluate the correctness of the output
:param task_name: Name of the task
:param input_path: Path to the user's input file
:param output_path: Path to the user's output file
:return: The stdout of the checker
"""
try:
# call the checker and store the output
output = gevent.subprocess.check_output([
ContestManager.tasks[task_name]["checker"],
StorageManager.get_absolute_path(input_path),
StorageManager.get_absolute_path(output_path)
])
except:
# TODO log the stdout and stderr of the checker
Logger.error(
"TASK", "Error while evaluating output %s "
"for task %s, with input %s: %s" %
(output_path, task_name, input_path, traceback.format_exc())
)
raise
Logger.info("TASK", "Evaluated output %s for task %s, with input %s" % (output_path, task_name, input_path))
return output
contest_manager.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录