|
@ -36,6 +36,7 @@ if len(sys.argv) < 2 or sys.argv[1] != "status": |
|
|
key = str(results[i]['problemId']) + "." + str(results[i]['seed']) |
|
|
key = str(results[i]['problemId']) + "." + str(results[i]['seed']) |
|
|
if key in resultsScore: |
|
|
if key in resultsScore: |
|
|
out_file = open(solutionsDir+str(results[i]['problemId'])+"."+str(results[i]['seed'])+"."+"%.110d"%resultsScore[key]+"."+strategy,"w") |
|
|
out_file = open(solutionsDir+str(results[i]['problemId'])+"."+str(results[i]['seed'])+"."+"%.110d"%resultsScore[key]+"."+strategy,"w") |
|
|
|
|
|
results[i]['tag'] = strategy |
|
|
out_file.write(json.dumps(results[i])) |
|
|
out_file.write(json.dumps(results[i])) |
|
|
out_file.close() |
|
|
out_file.close() |
|
|
else: |
|
|
else: |
|
@ -47,7 +48,7 @@ else: |
|
|
solutionsToSend=[] |
|
|
solutionsToSend=[] |
|
|
scores = {} |
|
|
scores = {} |
|
|
lastProblem = "" |
|
|
lastProblem = "" |
|
|
for solution in sorted(glob.glob(solutionsDir + str(results[0]['problemId']) + '*'), reverse=True): |
|
|
|
|
|
|
|
|
for solution in sorted(glob.glob(solutionsDir + str(results[0]['problemId']) + '.*'), reverse=True): |
|
|
problemHash = solution[:solution.rfind(".", 0, solution.rfind(".")) if solution.count('.') == 3 else solution.rfind(".")] |
|
|
problemHash = solution[:solution.rfind(".", 0, solution.rfind(".")) if solution.count('.') == 3 else solution.rfind(".")] |
|
|
if lastProblem != problemHash: |
|
|
if lastProblem != problemHash: |
|
|
lastProblem = problemHash |
|
|
lastProblem = problemHash |
|
@ -73,7 +74,13 @@ else: |
|
|
if not key in serverResults or serverResults[key]['createdAt'] < result['createdAt']: |
|
|
if not key in serverResults or serverResults[key]['createdAt'] < result['createdAt']: |
|
|
serverResults[key] = result |
|
|
serverResults[key] = result |
|
|
#print results |
|
|
#print results |
|
|
print "Submitted solution number: %d"%len(solutionsToSend) |
|
|
|
|
|
|
|
|
tags = {} |
|
|
|
|
|
for serverResult in serverResults: |
|
|
|
|
|
if not serverResults[serverResult]['tag'] in tags: |
|
|
|
|
|
tags[serverResults[serverResult]['tag']] = 1 |
|
|
|
|
|
else: |
|
|
|
|
|
tags[serverResults[serverResult]['tag']] += 1 |
|
|
|
|
|
print "Submitted solution: %d"%len(solutionsToSend) |
|
|
for solutionToSend in solutionsToSend: |
|
|
for solutionToSend in solutionsToSend: |
|
|
key = str(solutionToSend['problemId'])+"."+str(solutionToSend['seed']) |
|
|
key = str(solutionToSend['problemId'])+"."+str(solutionToSend['seed']) |
|
|
if not key in serverResults: |
|
|
if not key in serverResults: |
|
@ -81,19 +88,21 @@ else: |
|
|
else: |
|
|
else: |
|
|
if solutionToSend['solution'] != serverResults[key]['solution']: |
|
|
if solutionToSend['solution'] != serverResults[key]['solution']: |
|
|
print bcolors.FAIL + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution differ: " + solutionToSend['solution'] + " != " + serverResults[key]['solution'] + " (server)" + bcolors.ENDC |
|
|
print bcolors.FAIL + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution differ: " + solutionToSend['solution'] + " != " + serverResults[key]['solution'] + " (server)" + bcolors.ENDC |
|
|
print serverResults[key]['createdAt'] |
|
|
|
|
|
elif serverResults[key]['score'] == None: |
|
|
elif serverResults[key]['score'] == None: |
|
|
found = False |
|
|
found = False |
|
|
for i in range(1, len(results) + 1): |
|
|
for i in range(1, len(results) + 1): |
|
|
result = results[len(results)- i] |
|
|
result = results[len(results)- i] |
|
|
if result['problemId'] == solutionToSend['problemId'] and result['seed'] == solutionToSend['seed'] and result['solution'] == solutionToSend['solution'] and scores[key] == result['score']: |
|
|
if result['problemId'] == solutionToSend['problemId'] and result['seed'] == solutionToSend['seed'] and result['solution'] == solutionToSend['solution'] and scores[key] == result['score']: |
|
|
found = True |
|
|
found = True |
|
|
print bcolors.WARNING + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " " + bcolors.OKGREEN + "score " + result['score'] + " ok" + bcolors.ENDC + bcolors.WARNING + ", but solution evaluation pending" + bcolors.ENDC |
|
|
|
|
|
|
|
|
print bcolors.WARNING + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " " + bcolors.OKGREEN + "score " + str(result['score']) + " ok" + bcolors.ENDC + bcolors.WARNING + ", but solution evaluation pending" + bcolors.ENDC |
|
|
break |
|
|
break |
|
|
if not found: |
|
|
if not found: |
|
|
print bcolors.WARNING + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution evaluation pending" + bcolors.ENDC |
|
|
print bcolors.WARNING + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution evaluation pending" + bcolors.ENDC |
|
|
elif scores[key] != serverResults[key]['score']: |
|
|
elif scores[key] != serverResults[key]['score']: |
|
|
print bcolors.FAIL + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " score differ: " + str(scores[key]) + " != " + str(serverResults[key]['score']) + " (server)" + bcolors.ENDC |
|
|
print bcolors.FAIL + str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " score differ: " + str(scores[key]) + " != " + str(serverResults[key]['score']) + " (server)" + bcolors.ENDC |
|
|
|
|
|
print "Tags statistics:" |
|
|
|
|
|
for tag in tags: |
|
|
|
|
|
print " %s: %d"%(tag, tags[tag]) |
|
|
# print scores |
|
|
# print scores |
|
|
# print type(out) |
|
|
# print type(out) |
|
|
# print json.dumps(serverResults) |
|
|
# print json.dumps(serverResults) |
|
|