haha 3 年 前
コミット
a2c2570c1c
2 ファイル変更1 行追加11 行削除
  1. 1 1
      Dockerfile
  2. 0 10
      web/app.py

+ 1 - 1
Dockerfile

@@ -19,5 +19,5 @@ RUN pip3 install virtualenv \
 RUN cd /home/SEEC-Judge \
     && python3 setup.py install
 WORKDIR /home/SEEC-Judge/web
-CMD ["gunicorn","-w", "17", "-b", "0.0.0.0:5000", "app:app","--capture-output","--access-logfile","acc.log","--error-logfile","err.log"]
+CMD ["gunicorn","-w", "9", "-b", "0.0.0.0:5000", "app:app","--capture-output","--access-logfile","acc.log","--error-logfile","err.log"]
 

+ 0 - 10
web/app.py

@@ -2,7 +2,6 @@
 import os
 import random
 import shutil
-import time
 
 from flask import Flask, request, json
 import judgement
@@ -29,7 +28,6 @@ inputOutputMapping: hashmap 输入输出对
 
 @app.route('/api/judge', methods=['POST'])
 def judge():
-    start = time.time()
     requestData = request.get_data(as_text=True)
     data = json.loads(requestData)
     code = data['code']
@@ -38,10 +36,7 @@ def judge():
     memory_limit = int(data['memoryLimit'])
     input_list = data['inputList']
     output_list = data['outputList']
-
     app_path = os.getcwd()
-    app.logger.info(app_path)
-
     rand = int(random.random() * 10000000)
     dir_name = 'commit-' + str(rand)
     while os.path.exists(dir_name):
@@ -49,7 +44,6 @@ def judge():
         dir_name = 'commit-' + str(rand)
     os.mkdir(dir_name)
     os.chdir(app_path+'/'+dir_name)
-    app.logger.info(os.getcwd())
 
     if len(input_list) != len(output_list):
         return {"result_list": [{'result': "System Error"}],
@@ -58,12 +52,8 @@ def judge():
     save_test_cases(input_list, output_list, td_total)
     src_file = save_code(language, code)
     rst = judgement.judge(src_file, 'testcases', td_total, time_limit, memory_limit, language)
-    os.remove(src_file)
-    shutil.rmtree('testcases')
     os.chdir(app_path)
-    app.logger.info(os.getcwd())
     shutil.rmtree(dir_name)
-    app.logger.info(time.time() - start)
     return rst