[mlpack-svn] r15338 - in mlpack/conf/jenkins-conf/benchmark: . util
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jun 26 13:21:57 EDT 2013
Author: marcus
Date: Wed Jun 26 13:21:57 2013
New Revision: 15338
Log:
Use the run value to decide whether a script should be executed.
Modified:
mlpack/conf/jenkins-conf/benchmark/benchmark.py
mlpack/conf/jenkins-conf/benchmark/util/parser.py
Modified: mlpack/conf/jenkins-conf/benchmark/benchmark.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark.py Wed Jun 26 13:21:57 2013
@@ -2,7 +2,8 @@
@file benchmark.py
@author Marcus Edel
- In this file we read the config file and start the benchmark.
+ In this file we read the config file and start the benchmark or test the
+ config.
'''
@@ -34,7 +35,7 @@
def Main():
# Read Config.
- config = Parser('config.yaml')
+ config = Parser('config.yaml', verbose=False)
# Iterate through all libraries.
libraryMapping = config.GetConfigLibraryMethods()
@@ -44,48 +45,53 @@
methodMapping = config.GetConfigMethod(libraryMapping.methods)
while methodMapping and libraryMapping:
- # Load script.
- module = Loader.ImportModuleFromPath(methodMapping.script)
- methodCall = getattr(module, methodMapping.methodName)
-
- for dataset in methodMapping.datasets:
-
- #! TEMPORARY
- # Create table.
- table = []
- # set table header.
- header = ['', libraryMapping.libraryName, 'matlab', 'shougun']
- table.append(header)
-
- Log.Info('Options: ' + (dataset["options"] if dataset["options"] != '' else 'None'))
-
- for files in dataset["files"]:
-
- row = ['-'] * 4;
- # Get dataset name.
- if not isinstance(files, basestring):
- row[0] = os.path.splitext(os.path.basename(files[0]))[0]
- else:
- row[0] = os.path.splitext(os.path.basename(files))[0]
-
- Log.Info('Dataset: ' + row[0])
-
- time = 0
- for num in range(methodMapping.iteration):
- instance = methodCall(files, verbose=False)
- time += instance.RunMethod(dataset["options"]);
-
- # Call the destructor.
- del instance
-
- # Set time.
- row[1] = time / methodMapping.iteration
- table.append(row)
-
- # Show results in a table.
- Log.Notice('')
- Log.PrintTable(table)
- Log.Notice('')
+ if methodMapping.run:
+
+ Log.Info('Method: ' + methodMapping.methodName)
+
+ # Load script.
+ module = Loader.ImportModuleFromPath(methodMapping.script)
+ methodCall = getattr(module, methodMapping.methodName)
+
+ for dataset in methodMapping.datasets:
+
+ #! TEMPORARY
+ # Create table.
+ table = []
+ # set table header.
+ header = ['', libraryMapping.libraryName, 'matlab', 'shougun']
+ table.append(header)
+
+ Log.Info('Options: ' + (dataset["options"] if dataset["options"] != ''
+ else 'None'))
+
+ for files in dataset["files"]:
+
+ row = ['-'] * 4;
+ # Get dataset name.
+ if not isinstance(files, basestring):
+ row[0] = os.path.splitext(os.path.basename(files[0]))[0]
+ else:
+ row[0] = os.path.splitext(os.path.basename(files))[0]
+
+ Log.Info('Dataset: ' + row[0])
+
+ time = 0
+ for num in range(methodMapping.iteration):
+ instance = methodCall(files, verbose=False)
+ time += instance.RunMethod(dataset["options"]);
+
+ # Call the destructor.
+ del instance
+
+ # Set time.
+ row[1] = time / methodMapping.iteration
+ table.append(row)
+
+ # Show results in a table.
+ Log.Notice('')
+ Log.PrintTable(table)
+ Log.Notice('')
methodMapping = config.GetConfigMethod(libraryMapping.methods)
libraryMapping = config.GetConfigLibraryMethods()
Modified: mlpack/conf/jenkins-conf/benchmark/util/parser.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/parser.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/parser.py Wed Jun 26 13:21:57 2013
@@ -75,7 +75,7 @@
return False
methodName = method[0]
- Log.Info('Method: ' + methodName)
+ Log.Info('Method: ' + methodName, self.verbose)
attributes = method[1]
@@ -133,14 +133,14 @@
# Return empty list error message.
def ConfigEmptyErrorMsg(self, key, streamNum):
- Log.Fatal('Stream number: ' + str(streamNum) + ' the [' + key + '] list is empty.' )
+ Log.Fatal('Stream number: ' + str(streamNum) + ' the [' + key + '] list is empty.')
return False
def ConfigKeyWarnMsg(self, key, streamNum = 0):
if streamNum == 0:
- Log.Warn('No [' + key + '] key, use default value.')
+ Log.Warn('No [' + key + '] key, use default value.', self.verbose)
else:
- Log.Warn('Stream number: ' + str(streamNum) + ' has no [' + key + '] key, use default value.')
+ Log.Warn('Stream number: ' + str(streamNum) + ' has no [' + key + '] key, use default value.', self.verbose)
# Check config attributes and keys.
def CheckConfig(self):
More information about the mlpack-svn
mailing list