|
|
@ -50,18 +50,18 @@ else: |
|
|
|
import subprocess |
|
|
|
process = subprocess.Popen(['curl --user :2aaFCkjNIDHAsAIh9iQHc+Y+FGhkM5Z0RQgpO6TL6EA= -X GET https://davar.icfpcontest.org/teams/235/solutions'], shell = True, stdout=subprocess.PIPE) |
|
|
|
out, err = process.communicate() |
|
|
|
print 666 |
|
|
|
if err == None: |
|
|
|
print "Results:" |
|
|
|
serverResults = {} |
|
|
|
results = json.loads(out) |
|
|
|
for result in results: |
|
|
|
#2015-08-08T12:26:42.894Z |
|
|
|
date_object = datetime.strptime(result['createdAt'], '%Y-%m-%dT%H:%M:%S.%fZ') |
|
|
|
print str(date_object) |
|
|
|
# print str(date_object) |
|
|
|
key = str(result['problemId'])+"."+str(result['seed']) |
|
|
|
if not key in serverResults or serverResults[key]['createdAt'] < result['createdAt']: |
|
|
|
serverResults[key] = result |
|
|
|
print serverResults |
|
|
|
# print serverResults |
|
|
|
for solutionToSend in solutionsToSend: |
|
|
|
key = str(solutionToSend['problemId'])+"."+str(solutionToSend['seed']) |
|
|
|
if not key in serverResults: |
|
|
@ -69,12 +69,14 @@ else: |
|
|
|
else: |
|
|
|
if solutionToSend['solution'] != serverResults[key]['solution']: |
|
|
|
print str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution differ: " + solutionToSend['solution'] + " != " + serverResults[key]['solution'] + " (server)" |
|
|
|
elif serverResults[key]['score'] == None: |
|
|
|
print str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " solution evaluation pending" |
|
|
|
elif scores[key] != serverResults[key]['score']: |
|
|
|
print str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " score differ: " + scores[key] + " != " + serverResults[key]['score'] + " (server)" |
|
|
|
print scores |
|
|
|
print type(out) |
|
|
|
print json.dumps(serverResults) |
|
|
|
print len(serverResults) |
|
|
|
print str(solutionToSend['problemId'])+" "+str(solutionToSend['seed']) + " score differ: " + str(scores[key]) + " != " + str(serverResults[key]['score']) + " (server)" |
|
|
|
# print scores |
|
|
|
# print type(out) |
|
|
|
# print json.dumps(serverResults) |
|
|
|
# print len(serverResults) |
|
|
|
else: |
|
|
|
print "error retriving results from server" |
|
|
|
sys.exit(1) |
|
|
|