Make points for a run line up on the graphs

We do this by setting the timestamp for the run (which is used for
graphing purposes) once we know we can actually do the run. We also
sleep for a second in order to avoid having 2 different runs show up
with the same timestamp.

This also has the happy effect of making it so sum(totals) in the sql
queries for the graphs don't end up showing weird spikes on a day when
multiple runs are made. Hooray!
This commit is contained in:
Nick Hurley 2013-02-04 12:15:27 -08:00
Родитель b302929e08
Коммит 89558dfead
4 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -8,7 +8,6 @@ import json
import logging
import os
import platform
import time
import stoneridge
@ -52,7 +51,7 @@ class StoneRidgeInfoGatherer(object):
info = {'test_machine':machine_info,
'test_build':build_info,
'testrun':{},
'date':int(time.time())}
'date':stoneridge.get_config_int('run', 'tstamp')}
logging.debug('gathered info: %s' % (info,))
outdir = stoneridge.get_config('run', 'out')

Просмотреть файл

@ -6,6 +6,7 @@
import logging
import os
import subprocess
import time
import uuid
import stoneridge
@ -65,13 +66,25 @@ class StoneRidgeMaster(stoneridge.QueueListener):
# recovery we can do.
return
# In order to have the points for each OS/netconfig match up with each
# other for a particular test run (good for graphing), we set the
# timestamp once we know we're going to actually run the test (which is
# right now, after we've cloned the builds).
# We also sleep for one second, so we don't accidentally have 2
# different runs show up at the same time as each other on the graphs.
# Sure, it's unlikely, but sleeping for a second won't kill us, and
# better safe than sorry!
tstamp = int(time.time())
time.sleep(1)
for nc in netconfigs:
queue = self.queues.get(nc, None)
if queue is None:
logging.warning('Got request for invalid netconfig %s' % (nc,))
continue
queue.enqueue(operating_systems=operating_systems, srid=srid)
queue.enqueue(operating_systems=operating_systems, srid=srid,
tstamp=tstamp)
def daemon():

Просмотреть файл

@ -22,7 +22,7 @@ class StoneRidgeScheduler(stoneridge.QueueListener):
self.rpc_queue)
}
def handle(self, srid, operating_systems):
def handle(self, srid, operating_systems, tstamp):
for o in operating_systems:
runner = self.runners.get(o, None)
if runner is None:
@ -30,7 +30,7 @@ class StoneRidgeScheduler(stoneridge.QueueListener):
continue
logging.debug('Calling to run %s on %s' % (srid, o))
res = runner(srid=srid, netconfig=self.netconfig)
res = runner(srid=srid, netconfig=self.netconfig, tstamp=tstamp)
if res['ok']:
logging.debug('Run of %s on %s succeeded' % (srid, o))

Просмотреть файл

@ -8,7 +8,6 @@ import os
import subprocess
import sys
import tempfile
import time
import stoneridge
@ -29,14 +28,14 @@ class StoneRidgeWorker(stoneridge.RpcHandler):
self.runconfig = None # Needs to be here so reset doesn't barf
self.reset()
def handle(self, srid, netconfig):
def handle(self, srid, netconfig, tstamp):
# Have a logger just for this run
logdir = 'stoneridge_%s_%s' % (srid, netconfig)
self.logdir = os.path.join(self.srlogdir, logdir)
if os.path.exists(self.logdir):
# Don't blow away the old logs, just make a new directory for this
# run of the srid
self.logdir = '%s_%s' % (self.logdir, int(time.time()))
self.logdir = '%s_%s' % (self.logdir, tstamp)
os.makedirs(self.logdir)
logging.debug('Running test with logs in %s' % (self.logdir,))
@ -80,6 +79,7 @@ class StoneRidgeWorker(stoneridge.RpcHandler):
f.write('metadata = %s\n' % (metadata,))
f.write('info = %s\n' % (info,))
f.write('xpcoutleaf = %s\n' % (srxpcout,))
f.write('tstamp = %s\n' % (tstamp,))
f.write('srid = %s\n' % (srid,))
self.logger.debug('srnetconfig: %s' % (self.srnetconfig,))