upload_handler.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:territoriali-backend 作者: algorithm-ninja 项目源码 文件源码
def upload_output(self, input, file):
        """
        POST /upload_output
        """
        output_id = Database.gen_id()
        path = StorageManager.new_output_file(output_id, file["name"])

        StorageManager.save_file(path, file["content"])
        file_size = StorageManager.get_file_size(path)

        try:
            result = ContestManager.evaluate_output(input["task"], input["path"], path)
        except:
            BaseHandler.raise_exc(InternalServerError, "INTERNAL_ERROR", "Failed to evaluate the output")

        Database.add_output(output_id, input["id"], path, file_size, result)
        Logger.info("UPLOAD", "User %s has uploaded the output %s" % (input["token"], output_id))
        return InfoHandler.patch_output(Database.get_output(output_id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号