Commit 1ef0731b authored by Reto Da Forno's avatar Reto Da Forno
Browse files

check GPIO tracing file size before attempting to generate the plot

parent b41b04f5
......@@ -99,6 +99,7 @@ lockfile = /tmp/flocklab/linktest_schedule.lock
[viz]
generate_plots = 1 ;set to 1 to enable generation of plotting data
filesizelimit = 200000000 ;max. size for generated plots (html files)
gpiotracinglimit = 100000000 ;max. allowed file size for gpio tracing data (if larger, no plot will be generated)
dir = /home/flocklab/viz ;directory where plots are stored
; Cleaner which deletes test results (after a per-user retention time has expired)
......
......@@ -990,20 +990,26 @@ def prepare_testresults(testid, cur):
# Generate plot ---
if flocklab.config.getint('viz', 'generate_plots'):
owner = flocklab.get_test_owner(cur, testid)
if not os.path.isdir(flocklab.config.get('viz', 'dir')):
os.mkdir(flocklab.config.get('viz', 'dir'))
logger.debug("Generating plots...")
try:
showRSTandPPS = False
if owner != flocklab.FAILED and owner[6] == "admin":
showRSTandPPS = True
fltools.visualizeFlocklabTrace(testresultsdir, outputDir=flocklab.config.get('viz', 'dir'), interactive=False, showPps=showRSTandPPS, showRst=showRSTandPPS)
logger.debug("Plots generated.")
except Exception:
logger.error("Failed to generate results plot for test %d. %s: %s" % (testid, str(sys.exc_info()[0]), str(sys.exc_info()[1])))
except SystemExit:
pass
# Make sure the GPIO tracing file does not exceed a certain limit (otherwise plot generation will not complete)
tracingsize = os.path.getsize("%s/gpiotracing.csv" % testresultsdir)
allowedsize = flocklab.config.getint('viz', 'gpiotracinglimit')
if tracingsize > allowedsize:
logger.debug("Skipping plot generation.")
else:
owner = flocklab.get_test_owner(cur, testid)
if not os.path.isdir(flocklab.config.get('viz', 'dir')):
os.mkdir(flocklab.config.get('viz', 'dir'))
logger.debug("Generating plots...")
try:
showRSTandPPS = False
if owner != flocklab.FAILED and owner[6] == "admin":
showRSTandPPS = True
fltools.visualizeFlocklabTrace(testresultsdir, outputDir=flocklab.config.get('viz', 'dir'), interactive=False, showPps=showRSTandPPS, showRst=showRSTandPPS)
logger.debug("Plots generated.")
except Exception:
logger.error("Failed to generate results plot for test %d. %s: %s" % (testid, str(sys.exc_info()[0]), str(sys.exc_info()[1])))
except SystemExit:
pass
# Archive test results ---
cmd = [flocklab.config.get('dispatcher', 'archiverscript'),"--testid=%d" % testid]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment