mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 00:13:18 +00:00
修改判题端配置文件
This commit is contained in:
parent
cb7dd2f820
commit
088787443e
@ -13,7 +13,7 @@ from settings import judger_workspace
|
|||||||
|
|
||||||
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
|
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
|
||||||
|
|
||||||
from judger_controller.settings import mongodb_config
|
from judger_controller.settings import celery_mongodb_config, docker_mongodb_config
|
||||||
|
|
||||||
|
|
||||||
# 简单的解析命令行参数
|
# 简单的解析命令行参数
|
||||||
@ -25,7 +25,7 @@ time_limit = args[4]
|
|||||||
memory_limit = args[6]
|
memory_limit = args[6]
|
||||||
test_case_id = args[8]
|
test_case_id = args[8]
|
||||||
|
|
||||||
connection = pymongo.MongoClient(host=mongodb_config["host"], port=mongodb_config["port"])
|
connection = pymongo.MongoClient(host=docker_mongodb_config["host"], port=docker_mongodb_config["port"])
|
||||||
collection = connection["oj"]["oj_submission"]
|
collection = connection["oj"]["oj_submission"]
|
||||||
|
|
||||||
submission = collection.find_one({"_id": ObjectId(submission_id)})
|
submission = collection.find_one({"_id": ObjectId(submission_id)})
|
||||||
@ -45,7 +45,7 @@ try:
|
|||||||
exe_path = compile_(language, src_path, judger_workspace + "run/")
|
exe_path = compile_(language, src_path, judger_workspace + "run/")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print e
|
||||||
connection = pymongo.MongoClient(host=mongodb_config["host"], port=mongodb_config["port"])
|
connection = pymongo.MongoClient(host=docker_mongodb_config["host"], port=docker_mongodb_config["port"])
|
||||||
collection = connection["oj"]["oj_submission"]
|
collection = connection["oj"]["oj_submission"]
|
||||||
data = {"result": result["compile_error"], "info": str(e)}
|
data = {"result": result["compile_error"], "info": str(e)}
|
||||||
collection.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": data})
|
collection.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": data})
|
||||||
@ -77,7 +77,7 @@ except Exception as e:
|
|||||||
|
|
||||||
print "Run successfully"
|
print "Run successfully"
|
||||||
print judge_result
|
print judge_result
|
||||||
connection = pymongo.MongoClient(host=mongodb_config["host"], port=mongodb_config["port"])
|
connection = pymongo.MongoClient(host=docker_mongodb_config["host"], port=docker_mongodb_config["port"])
|
||||||
collection = connection["oj"]["oj_submission"]
|
collection = connection["oj"]["oj_submission"]
|
||||||
collection.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": judge_result})
|
collection.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": judge_result})
|
||||||
connection.close()
|
connection.close()
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
redis_config = {
|
redis_config = {
|
||||||
"host": "127.0.0.1",
|
"host": "121.42.196.141",
|
||||||
"port": 6379,
|
"port": 6379,
|
||||||
"db": 0
|
"db": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docker_config = {
|
docker_config = {
|
||||||
"image_name": "judger",
|
"image_name": "d622347336b8",
|
||||||
"docker_path": "docker",
|
"docker_path": "docker",
|
||||||
"shell": True
|
"shell": True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
test_case_dir = "/Users/virusdefender/Desktop/test_case/"
|
test_case_dir = "/root/test_case/"
|
||||||
source_code_dir = "/Users/virusdefender/Desktop/"
|
source_code_dir = "/root/"
|
||||||
|
|
||||||
|
|
||||||
mongodb_config = {
|
celery_mongodb_config = {
|
||||||
"host": "192.168.59.3",
|
"host": "127.0.0.1",
|
||||||
|
"username": "root",
|
||||||
|
"password": "root",
|
||||||
|
"port": 27017
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_mongodb_config = {
|
||||||
|
"host": "192.168.42.1",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
"password": "root",
|
"password": "root",
|
||||||
"port": 27017
|
"port": 27017
|
||||||
|
@ -16,8 +16,9 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 这是web 服务器连接到mongodb 的地址
|
||||||
MONGODB = {
|
MONGODB = {
|
||||||
'HOST': '127.0.0.1',
|
'HOST': '121.42.196.141',
|
||||||
'USERNAME': 'root',
|
'USERNAME': 'root',
|
||||||
'PASSWORD': 'root',
|
'PASSWORD': 'root',
|
||||||
'PORT': 27017
|
'PORT': 27017
|
||||||
@ -26,4 +27,4 @@ MONGODB = {
|
|||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
# 同理 这是 web 服务器的上传路径
|
# 同理 这是 web 服务器的上传路径
|
||||||
TEST_CASE_DIR = "/Users/virusdefender/Desktop/test_case/"
|
TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case')
|
||||||
|
@ -14,7 +14,7 @@ from judge.judger_controller.tasks import judge
|
|||||||
from account.decorators import login_required
|
from account.decorators import login_required
|
||||||
from problem.models import Problem
|
from problem.models import Problem
|
||||||
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page
|
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page
|
||||||
from .serializers import CreateSubmissionSerializer
|
from .serializers import CreateSubmissionSerializer
|
||||||
|
|
||||||
|
|
||||||
def _create_mongodb_connection():
|
def _create_mongodb_connection():
|
||||||
|
Loading…
Reference in New Issue
Block a user