Commit d3ba4b69 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

remove plots that are too large to be displayed

parent fb610ad0
...@@ -98,6 +98,7 @@ lockfile = /tmp/flocklab/linktest_schedule.lock ...@@ -98,6 +98,7 @@ lockfile = /tmp/flocklab/linktest_schedule.lock
; vizualisation of test results ; vizualisation of test results
[viz] [viz]
generate_plots = 1 ;set to 1 to enable generation of plotting data generate_plots = 1 ;set to 1 to enable generation of plotting data
filesizelimit = 200000000 ;max. size for generated plots (html files)
dir = /home/flocklab/viz ;directory where plots are stored dir = /home/flocklab/viz ;directory where plots are stored
; Cleaner which deletes test results (after a per-user retention time has expired) ; Cleaner which deletes test results (after a per-user retention time has expired)
......
...@@ -170,12 +170,14 @@ def main(argv): ...@@ -170,12 +170,14 @@ def main(argv):
# Delete old entries in viz cache --- # Delete old entries in viz cache ---
keeptime = flocklab.config.getint('cleaner', 'keeptime_viz') keeptime = flocklab.config.getint('cleaner', 'keeptime_viz')
maxfilesize = flocklab.config.getint('viz', 'filesizelimit')
earliest_keeptime = time.time() - (keeptime * 86400) earliest_keeptime = time.time() - (keeptime * 86400)
vizdir = flocklab.config.get('viz','dir') vizdir = flocklab.config.get('viz','dir')
if os.path.isdir(vizdir): if os.path.isdir(vizdir):
for f in os.listdir(vizdir): for f in os.listdir(vizdir):
path = os.path.join(vizdir, f) path = os.path.join(vizdir, f)
if os.stat(path).st_mtime < earliest_keeptime: # either an old plot or a large file (which cannot be displayed anyways)
if os.stat(path).st_mtime < earliest_keeptime or os.path.getsize(path) > maxfilesize:
logger.info("Removing plots %s..." % path) logger.info("Removing plots %s..." % path)
os.remove(path) os.remove(path)
else: else:
......
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