[mlpack-svn] r15555 - mlpack/conf/jenkins-conf/benchmark/methods/weka
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Jul 26 09:00:51 EDT 2013
Author: marcus
Date: Fri Jul 26 09:00:51 2013
New Revision: 15555
Log:
Add timeout for the weka benchmark scripts.
Modified:
mlpack/conf/jenkins-conf/benchmark/methods/weka/allknn.py
mlpack/conf/jenkins-conf/benchmark/methods/weka/kmeans.py
mlpack/conf/jenkins-conf/benchmark/methods/weka/linear_regression.py
mlpack/conf/jenkins-conf/benchmark/methods/weka/nbc.py
mlpack/conf/jenkins-conf/benchmark/methods/weka/pca.py
Modified: mlpack/conf/jenkins-conf/benchmark/methods/weka/allknn.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/weka/allknn.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/weka/allknn.py Fri Jul 26 09:00:51 2013
@@ -33,13 +33,16 @@
Create the All K-Nearest-Neighbors benchmark instance.
@param dataset - Input dataset to perform ALLKNN on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the mlpack executable.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["WEKA_CLASSPATH"], verbose = True):
+ def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"],
+ verbose = True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
All K-Nearest-Neighbors. If the method has been successfully completed return
@@ -65,7 +68,11 @@
# Run command with the nessecary arguments and return its output as a byte
# string. We have untrusted input so we disables all shell based features.
try:
- s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False)
+ s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
+ timeout=self.timeout)
+ except subprocess.TimeoutExpired as e:
+ Log.Warn(str(e))
+ return -2
except Exception:
Log.Fatal("Could not execute command: " + str(cmd))
return -1
Modified: mlpack/conf/jenkins-conf/benchmark/methods/weka/kmeans.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/weka/kmeans.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/weka/kmeans.py Fri Jul 26 09:00:51 2013
@@ -33,13 +33,16 @@
Create the K-Means Clustering benchmark instance.
@param dataset - Input dataset to perform K-Means on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the mlpack executable.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["WEKA_CLASSPATH"], verbose = True):
+ def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
K-Means Clustering benchmark instance. If the method has been successfully
@@ -58,7 +61,11 @@
# Run command with the nessecary arguments and return its output as a byte
# string. We have untrusted input so we disables all shell based features.
try:
- s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False)
+ s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
+ timeout=self.timeout)
+ except subprocess.TimeoutExpired as e:
+ Log.Warn(str(e))
+ return -2
except Exception:
Log.Fatal("Could not execute command: " + str(cmd))
return -1
Modified: mlpack/conf/jenkins-conf/benchmark/methods/weka/linear_regression.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/weka/linear_regression.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/weka/linear_regression.py Fri Jul 26 09:00:51 2013
@@ -33,13 +33,16 @@
Create the Linear Regression benchmark instance.
@param dataset - Input dataset to perform Linear Regression on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the mlpack executable.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["WEKA_CLASSPATH"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Linear Regression. If the method has been successfully completed return
@@ -65,7 +68,11 @@
# Run command with the nessecary arguments and return its output as a byte
# string. We have untrusted input so we disables all shell based features.
try:
- s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False)
+ s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
+ timeout=self.timeout)
+ except subprocess.TimeoutExpired as e:
+ Log.Warn(str(e))
+ return -2
except Exception:
Log.Fatal("Could not execute command: " + str(cmd))
return -1
Modified: mlpack/conf/jenkins-conf/benchmark/methods/weka/nbc.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/weka/nbc.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/weka/nbc.py Fri Jul 26 09:00:51 2013
@@ -33,13 +33,16 @@
Create the Naive Bayes Classifier benchmark instance.
@param dataset - Input dataset to perform NBC on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the mlpack executable.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["WEKA_CLASSPATH"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Naive Bayes Classifier. If the method has been successfully completed return
@@ -62,7 +65,11 @@
# Run command with the nessecary arguments and return its output as a byte
# string. We have untrusted input so we disables all shell based features.
try:
- s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False)
+ s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
+ timeout=self.timeout)
+ except subprocess.TimeoutExpired as e:
+ Log.Warn(str(e))
+ return -2
except Exception:
Log.Fatal("Could not execute command: " + str(cmd))
return -1
Modified: mlpack/conf/jenkins-conf/benchmark/methods/weka/pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/weka/pca.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/weka/pca.py Fri Jul 26 09:00:51 2013
@@ -33,13 +33,16 @@
Create the Principal Components Analysis benchmark instance.
@param dataset - Input dataset to perform PCA on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the mlpack executable.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["WEKA_CLASSPATH"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Perform Principal Components Analysis. If the method has been successfully
@@ -58,7 +61,11 @@
# Run command with the nessecary arguments and return its output as a byte
# string. We have untrusted input so we disables all shell based features.
try:
- s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False)
+ s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
+ timeout=self.timeout)
+ except subprocess.TimeoutExpired as e:
+ Log.Warn(str(e))
+ return -2
except Exception:
Log.Fatal("Could not execute command: " + str(cmd))
return -1
More information about the mlpack-svn
mailing list