sandbox_client.py 文件源码

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

项目:xiaoxiang-oj 作者: hanfei19910905 项目源码 文件源码
def call(self, submit_id, result_path, data_path, judge_path):
        rpc_body = encode(submit_id, result_path, data_path, judge_path)
        for i in range(5):
            try:
                app.logger.info("try!! %s %s %s %s" % (submit_id, result_path, data_path, judge_path))
                self.channel.basic_publish(exchange='',
                                           routing_key=self.ch,
                                           properties=pika.BasicProperties(
                                                 delivery_mode=2,
                                                 ),
                                           body=rpc_body)
                return
            except pika.exceptions.ConnectionClosed:
                self.connection = pika.BlockingConnection(pika.ConnectionParameters(
                    host='localhost'))

                self.channel = self.connection.channel()

                self.channel.queue_declare(queue=self.ch, durable=True)

        app.logger.info("local!! %s %s %s %s" % (submit_id, result_path, data_path, judge_path))
        #convert to local judge. that's a sync way!
        from .sandbox_server import SandBoxService
        SandBoxService.local_exec(submit_id, result_path, data_path, judge_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号