[mlpack-svn] r15554 - mlpack/conf/jenkins-conf/benchmark/methods/matlab
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Jul 26 08:51:21 EDT 2013
Author: marcus
Date: Fri Jul 26 08:51:21 2013
New Revision: 15554
Log:
Add timeout for the matlab benchmark scripts.
Modified:
mlpack/conf/jenkins-conf/benchmark/methods/matlab/allknn.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_generate.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_viterbi.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/kmeans.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/linear_regression.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/nbc.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/nmf.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/pca.py
mlpack/conf/jenkins-conf/benchmark/methods/matlab/range_search.py
Modified: mlpack/conf/jenkins-conf/benchmark/methods/matlab/allknn.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/allknn.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/allknn.py Fri Jul 26 08:51:21 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 matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ 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/matlab/hmm_generate.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_generate.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_generate.py Fri Jul 26 08:51:21 2013
@@ -33,13 +33,16 @@
Create the HMM Sequence Generator benchmark instance.
@param dataset - Input dataset to perform the HMM Sequence Generator on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
self.error = 0
# Open the HMM xml model file and extract the emis and trans values.
@@ -107,7 +110,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/matlab/hmm_viterbi.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_viterbi.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/hmm_viterbi.py Fri Jul 26 08:51:21 2013
@@ -33,13 +33,16 @@
Create the HMM Sequence Log-Likelihood benchmark instance.
@param dataset - Input dataset to perform the HMM Sequence Log-Likelihood on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
self.error = 0
if len(dataset) != 2:
@@ -108,7 +111,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/matlab/kmeans.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/kmeans.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/kmeans.py Fri Jul 26 08:51:21 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 matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ 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
@@ -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/matlab/linear_regression.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/linear_regression.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/linear_regression.py Fri Jul 26 08:51:21 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 matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Linear Regression benchmark instance. If the method has been successfully
@@ -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/matlab/nbc.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/nbc.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/nbc.py Fri Jul 26 08:51:21 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 matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ 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
@@ -59,7 +62,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/matlab/nmf.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/nmf.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/nmf.py Fri Jul 26 08:51:21 2013
@@ -33,13 +33,16 @@
Create the Non-negative Matrix Factorization benchmark instance.
@param dataset - Input dataset to perform NMF on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Non-negative Matrix Factorization. If the method has been successfully
@@ -59,7 +62,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/matlab/pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/pca.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/pca.py Fri Jul 26 08:51:21 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 matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Perform Principal Components Analysis. If the method has been successfully
@@ -59,7 +62,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/matlab/range_search.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/matlab/range_search.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/matlab/range_search.py Fri Jul 26 08:51:21 2013
@@ -33,13 +33,16 @@
Create the Range Search benchmark instance.
@param dataset - Input dataset to perform Range Search on.
+ @param timeout - The time until the timeout. Default no timeout.
@param path - Path to the matlab binary.
@param verbose - Display informational messages.
'''
- def __init__(self, dataset, path=os.environ["MATLAB_BIN"], verbose=True):
+ def __init__(self, dataset, timeout=0, path=os.environ["MATLAB_BIN"],
+ verbose=True):
self.verbose = verbose
self.dataset = dataset
self.path = path
+ self.timeout = timeout
'''
Perform Range Search. If the method has been successfully completed return the
@@ -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
More information about the mlpack-svn
mailing list