修改判题端配置文件

This commit is contained in:
virusdefender 2015-08-15 17:00:55 +08:00
parent cb7dd2f820
commit 088787443e
4 changed files with 21 additions and 13 deletions

View File

@ -13,7 +13,7 @@ from settings import judger_workspace
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]
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"]
submission = collection.find_one({"_id": ObjectId(submission_id)})
@ -45,7 +45,7 @@ try:
exe_path = compile_(language, src_path, judger_workspace + "run/")
except Exception as 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"]
data = {"result": result["compile_error"], "info": str(e)}
collection.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": data})
@ -77,7 +77,7 @@ except Exception as e:
print "Run successfully"
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.find_one_and_update({"_id": ObjectId(submission_id)}, {"$set": judge_result})
connection.close()

View File

@ -1,24 +1,31 @@
# coding=utf-8
redis_config = {
"host": "127.0.0.1",
"host": "121.42.196.141",
"port": 6379,
"db": 0
}
docker_config = {
"image_name": "judger",
"image_name": "d622347336b8",
"docker_path": "docker",
"shell": True
}
test_case_dir = "/Users/virusdefender/Desktop/test_case/"
source_code_dir = "/Users/virusdefender/Desktop/"
test_case_dir = "/root/test_case/"
source_code_dir = "/root/"
mongodb_config = {
"host": "192.168.59.3",
celery_mongodb_config = {
"host": "127.0.0.1",
"username": "root",
"password": "root",
"port": 27017
}
docker_mongodb_config = {
"host": "192.168.42.1",
"username": "root",
"password": "root",
"port": 27017

View File

@ -16,8 +16,9 @@ DATABASES = {
}
}
# 这是web 服务器连接到mongodb 的地址
MONGODB = {
'HOST': '127.0.0.1',
'HOST': '121.42.196.141',
'USERNAME': 'root',
'PASSWORD': 'root',
'PORT': 27017
@ -26,4 +27,4 @@ MONGODB = {
DEBUG = True
# 同理 这是 web 服务器的上传路径
TEST_CASE_DIR = "/Users/virusdefender/Desktop/test_case/"
TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case')