[mlpack-svn] r15783 - in mlpack/conf/jenkins-conf/benchmark: benchmark util

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Sep 14 08:35:41 EDT 2013


Author: marcus
Date: Sat Sep 14 08:35:40 2013
New Revision: 15783

Log:
Catch exception if there is not data available in the database.

Modified:
   mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
   mlpack/conf/jenkins-conf/benchmark/util/database.py

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	Sat Sep 14 08:35:40 2013
@@ -34,7 +34,11 @@
 @return The filename of the line chart.
 '''
 def CreateTopLineChart(db):
-  build, results = db.GetResultsSum("mlpack")
+  res = db.GetResultsSum("mlpack")
+  if res:
+    build, results = res
+  else:
+    return ""
 
   GenerateSingleLineChart(results, "reports/img/mlpack_top_" + str(build) + 
       ".png", backgroundColor="#F3F3F3", windowWidth=9, windowHeight=1.6)
@@ -164,6 +168,7 @@
 '''
 def MethodReports(db):
   methodsPage = ""
+  numDatasets = 0
 
   # Get the latest builds.
   libraryIds  = db.GetLibraryIds()
@@ -233,7 +238,12 @@
       # Generate a "unique" name for the line chart.
       lineChartName = "img/line_" + chartHash + ".png"
 
-      build, methodResultsSum = db.GetResultsMethodSum("mlpack", methodId)
+      res = db.GetResultsMethodSum("mlpack", methodId)
+      if res:
+        build, methodResultsSum = res
+      else:
+        continue
+
       GenerateSingleLineChart(methodResultsSum, "reports/" + lineChartName)
 
       # Generate a "unique" name for the bar chart.

Modified: mlpack/conf/jenkins-conf/benchmark/util/database.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/database.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/util/database.py	Sat Sep 14 08:35:40 2013
@@ -283,7 +283,7 @@
   Get the sum of the time column of all build of the given name.
 
   @param name - The name of the library.
-  @return The sum of the time column.
+  @return The sum of the time column if there are records otherwise None.
   '''
   def GetResultsSum(self, name):
     libaryId = self.GetLibrary(name)[0][0]
@@ -291,11 +291,15 @@
       self.cur.execute("SELECT id FROM builds WHERE libary_id=" + str(libaryId) 
           + " ORDER BY build ASC")
       timeSummed = []
-      for buildId in self.cur.fetchall(): 
+      res = self.cur.fetchall()
+      for buildId in res: 
         self.cur.execute("SELECT SUM(time) FROM results WHERE build_id=" + 
            str(buildId[0]))
         timeSummed.append(self.cur.fetchall()[0][0])
-    return (buildId[0], timeSummed)
+    if res:
+      return (buildId[0], timeSummed)
+    else:
+      return None
 
   '''
   Get the ids of all libraries.
@@ -352,7 +356,7 @@
 
   @param name - The name of the library.
   @param methodId - The method id.
-  @return The sum of the time column.
+  @return The sum of the time column if there are records otherwise None.
   '''
   def GetResultsMethodSum(self, name, methodId):
     libaryId = self.GetLibrary(name)[0][0]
@@ -360,11 +364,15 @@
       self.cur.execute("SELECT id FROM builds WHERE libary_id=" + str(libaryId) 
           + " ORDER BY build ASC")
       timeSummed = []
-      for buildId in self.cur.fetchall():
+      res = self.cur.fetchall()
+      for buildId in res:
         self.cur.execute("SELECT SUM(time) FROM results WHERE build_id=" + 
            str(buildId[0]) + " AND method_id=" + str(methodId))
         timeSummed.append(self.cur.fetchall()[0][0])
-    return (buildId[0], timeSummed)
+    if res:
+      return (buildId[0], timeSummed)
+    else:
+      return None
 
   '''
   Add a new memory record to the memory table.



More information about the mlpack-svn mailing list