daca2-report: get results from aws and show most recent results on web

This commit is contained in:
Daniel Marjamäki 2013-11-27 19:17:22 +01:00
parent 771dc2e1ad
commit 6b4016be42
1 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import os import os
import sys import sys
import subprocess
def readdate(data): def readdate(data):
@ -30,6 +31,13 @@ def readdate(data):
return None return None
datepos = datepos + 1 datepos = datepos + 1
if os.path.isfile(os.path.expanduser('~/aws-debian.pem')):
subprocess.call(['scp',
'-i',
os.path.expanduser('~/aws-debian.pem'),
'admin@ec2-54-201-59-232.us-west-2.compute.amazonaws.com:daca2/results-*.txt',
os.path.expanduser('~/daca2/')])
path = '.' path = '.'
if len(sys.argv) == 2: if len(sys.argv) == 2:
path = sys.argv[1] path = sys.argv[1]
@ -75,6 +83,17 @@ for lib in range(2):
f.close() f.close()
datestr = readdate(data) datestr = readdate(data)
if os.path.isfile(daca2 + 'results-' + a + '.txt'):
f2 = open(daca2 + 'results-' + a + '.txt')
data2 = f2.read()
f2.close()
datestr2 = readdate(data2)
if not datestr or datestr < datestr2:
data = data2
datestr = datestr2
if datestr: if datestr:
if not lastupdate or datestr > lastupdate: if not lastupdate or datestr > lastupdate:
lastupdate = datestr lastupdate = datestr