Explorar o código

Update app.py

haha %!s(int64=3) %!d(string=hai) anos
pai
achega
3f52d3396a
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      web/app.py

+ 4 - 0
web/app.py

@@ -1,6 +1,8 @@
 # encoding: utf8
 import os
 import shutil
+from datetime import time
+
 from flask import Flask, request, json
 import judgement
 
@@ -23,6 +25,7 @@ inputOutputMapping: hashmap 输入输出对
 
 @app.route('/api/judge', methods=['POST'])
 def judge():
+    start = time()
     data = json.loads(request.get_data(as_text=True))
     code = data['code']
     language = data['language']
@@ -39,6 +42,7 @@ def judge():
     rst = judgement.judge(src_file, 'testcases', td_total, time_limit, memory_limit, language)
     os.remove(src_file)
     shutil.rmtree('testcases')
+    print(time()-start)
     return rst