[med-svn] [python-mne] 322/353: Import joblib directly if sklearn not installed

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:25:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

yoh pushed a commit to tag 0.4
in repository python-mne.

commit 91b6cd8881fbe322fe3b1fc232c5a33392dbcf8d
Author: Brad Buran <bburan at alum.mit.edu>
Date:   Sat Jul 28 16:57:10 2012 -0400

    Import joblib directly if sklearn not installed
---
 mne/parallel.py | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/mne/parallel.py b/mne/parallel.py
index 5c744a4..a2ce7b9 100644
--- a/mne/parallel.py
+++ b/mne/parallel.py
@@ -31,20 +31,26 @@ def parallel_func(func, n_jobs, verbose=5):
     """
     try:
         from sklearn.externals.joblib import Parallel, delayed
-        parallel = Parallel(n_jobs, verbose=verbose)
-        my_func = delayed(func)
-
-        if n_jobs == -1:
-            try:
-                import multiprocessing
-                n_jobs = multiprocessing.cpu_count()
-            except ImportError:
-                print "multiprocessing not installed. Cannot run in parallel."
-                n_jobs = 1
-
     except ImportError:
-        print "joblib not installed. Cannot run in parallel."
-        n_jobs = 1
-        my_func = func
-        parallel = list
+        try:
+            from joblib import Parallel, delayed
+        except ImportError:
+            print "joblib not installed. Cannot run in parallel."
+            n_jobs = 1
+            my_func = func
+            parallel = list
+
+        return parallel, my_func, n_jobs
+
+    parallel = Parallel(n_jobs, verbose=verbose)
+    my_func = delayed(func)
+
+    if n_jobs == -1:
+        try:
+            import multiprocessing
+            n_jobs = multiprocessing.cpu_count()
+        except ImportError:
+            print "multiprocessing not installed. Cannot run in parallel."
+            n_jobs = 1
+
     return parallel, my_func, n_jobs

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git



More information about the debian-med-commit mailing list