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)
评论列表
文章目录