|
|
@@ -1,5 +1,6 @@
|
|
|
# encoding: utf8
|
|
|
import os
|
|
|
+import random
|
|
|
import shutil
|
|
|
import time
|
|
|
|
|
|
@@ -33,7 +34,6 @@ def judge():
|
|
|
data = json.loads(requestData)
|
|
|
code = data['code']
|
|
|
language = data['language']
|
|
|
- cid = str(data['commitId'])
|
|
|
time_limit = int(data['timeLimit'])
|
|
|
memory_limit = int(data['memoryLimit'])
|
|
|
input_list = data['inputList']
|
|
|
@@ -42,9 +42,11 @@ def judge():
|
|
|
app_path = os.getcwd()
|
|
|
app.logger.info(app_path)
|
|
|
|
|
|
- dir_name = 'commit-' + cid
|
|
|
- if os.path.exists(dir_name):
|
|
|
- shutil.rmtree(dir_name)
|
|
|
+ rand = int(random.random() * 10000000)
|
|
|
+ dir_name = 'commit-' + str(rand)
|
|
|
+ while os.path.exists(dir_name):
|
|
|
+ rand = rand+1
|
|
|
+ dir_name = 'commit-' + str(rand)
|
|
|
os.mkdir(dir_name)
|
|
|
os.chdir(app_path+'/'+dir_name)
|
|
|
app.logger.info(os.getcwd())
|