[mlpack-svn] r15694 - in mlpack/conf/jenkins-conf/benchmark: . benchmark
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Aug 29 10:19:25 EDT 2013
Author: marcus
Date: Thu Aug 29 10:19:24 2013
New Revision: 15694
Log:
Add a option to delete old reports.
Modified:
mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
mlpack/conf/jenkins-conf/benchmark/config.yaml
mlpack/conf/jenkins-conf/benchmark/small_config.yaml
Modified: mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py Thu Aug 29 10:19:24 2013
@@ -334,9 +334,13 @@
'''
Adjust the pagination for all index.html files.
'''
-def AdjustPagination():
+def AdjustPagination(maxFiles):
maxId, files = GetMaxIndex()
+ delFiles = []
+ if maxId >= maxFiles:
+ maxId -= 1
+
for i in range(1, files + 1):
with open("reports/index_" + str(i) + ".html", "r+") as fid:
content = fid.read()
@@ -357,7 +361,17 @@
content += paginationTemplate
fid.seek(0)
fid.write(content)
- fid.truncate()
+ fid.truncate()
+
+ # Delete unneeded files.
+ if i < maxFiles:
+ delFiles.extend(re.findall('src="img/(.*?)"', content))
+ else:
+ c = re.findall('src="img/(.*?)"', content)
+ delFiles = ["reports/img" + img for img in c if img not in delFiles]
+ delFiles.append("reports/index_" + str(i) + ".html")
+ fid.close()
+ RemoveDataset(delFiles)
'''
Get the pagination for the new index.html file.
@@ -380,10 +394,15 @@
'''
def ShiftReports():
maxId, files = GetMaxIndex()
- if maxId > 0 and os.path.isfile("reports/index.html"):
- os.rename("reports/index.html", "reports/index_" + str(maxId + 1) + ".html")
- elif files > 0 and os.path.isfile("reports/index.html"):
- os.rename("reports/index.html", "reports/index_1.html")
+
+ for i in range(files, 0, -1):
+ fileName = "reports/index_" + str(i) + ".html"
+ if CheckFileAvailable(fileName):
+ os.rename(fileName, "reports/index_" + str(i + 1) + ".html")
+
+ fileName = "reports/index.html"
+ if CheckFileAvailable(fileName):
+ os.rename(fileName, "reports/index_1.html")
'''
Create the new report.
@@ -393,6 +412,7 @@
def Main(configfile):
# Reports settings.
database = "reports/benchmark.db"
+ keepReports = 3
# Create the folder structure.
CreateDirectoryStructure(["reports/img", "reports/etc"])
@@ -406,12 +426,14 @@
for key, value in streamData["general"]:
if key == "database":
database = value
+ elif key == "keepReports":
+ keepReports = value
db = Database(database)
db.CreateTables()
ShiftReports()
- AdjustPagination()
+ AdjustPagination(keepReports)
# Get the values for the new index.html file.
reportValues = {}
Modified: mlpack/conf/jenkins-conf/benchmark/config.yaml
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/config.yaml (original)
+++ mlpack/conf/jenkins-conf/benchmark/config.yaml Thu Aug 29 10:19:24 2013
@@ -4,6 +4,7 @@
# Time until a timeout in seconds.
timeout: 9000
database: 'reports/benchmark.db'
+ keepReports: 20
---
# MLPACK:
# A Scalable C++ Machine Learning Library
Modified: mlpack/conf/jenkins-conf/benchmark/small_config.yaml
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/small_config.yaml (original)
+++ mlpack/conf/jenkins-conf/benchmark/small_config.yaml Thu Aug 29 10:19:24 2013
@@ -4,6 +4,7 @@
# Time until a timeout in seconds.
timeout: 9000
database: 'reports/benchmark.db'
+ keepReports: 20
---
# MLPACK:
# A Scalable C++ Machine Learning Library
More information about the mlpack-svn
mailing list