1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Author: Andreas Tille <tille@debian.org>
Last-Changed: Tue, 03 Mar 2015 20:55:53 +0100
Description: We are using Debian packaged python-joblib
Debian has its own way to distinguish Python versions and there is no point
in doing this inside the code.
.
The patch is non-intrusive since it conserves the original code and uses
Debian pyyaml only if the original method fails.
--- a/src/spades_pipeline/hammer_logic.py
+++ b/src/spades_pipeline/hammer_logic.py
@@ -46,10 +46,13 @@ def compress_dataset_files(dataset_data,
support.sys_call([pigz_path, '-f', '-7', '-p', str(max_threads), reads_file], log)
else:
addsitedir(ext_python_modules_home)
- if sys.version.startswith('2.'):
- from joblib2 import Parallel, delayed
- elif sys.version.startswith('3.'):
- from joblib3 import Parallel, delayed
+ try:
+ if sys.version.startswith('2.'):
+ from joblib2 import Parallel, delayed
+ elif sys.version.startswith('3.'):
+ from joblib3 import Parallel, delayed
+ except:
+ from joblib import Parallel, delayed
n_jobs = min(len(to_compress), max_threads)
outputs = Parallel(n_jobs=n_jobs)(delayed(support.sys_call)(['gzip', '-f', '-7', reads_file]) for reads_file in to_compress)
for output in outputs:
--- a/src/spades_pipeline/lucigen_nxmate.py
+++ b/src/spades_pipeline/lucigen_nxmate.py
@@ -43,12 +43,14 @@ except ImportError:
support.error("Can't process Lucigen NxMate reads! Python module regex is not installed!")
addsitedir(spades_init.ext_python_modules_home)
-if sys.version.startswith('2.'):
- from joblib2 import Parallel, delayed
-elif sys.version.startswith('3.'):
- from joblib3 import Parallel, delayed
+try:
+ if sys.version.startswith('2.'):
+ from joblib2 import Parallel, delayed
+ elif sys.version.startswith('3.'):
+ from joblib3 import Parallel, delayed
+except:
+ from joblib import Parallel, delayed
-
# CONSTANTS
READS_PER_THREAD = 25000
READS_PER_BATCH = READS_PER_THREAD * options_storage.threads # e.g. 100000 for 4 threads
|