diff --git a/.aux/test_with_lcg b/.aux/test_with_lcg index 8923cec5..5a11d9c5 100755 --- a/.aux/test_with_lcg +++ b/.aux/test_with_lcg @@ -4,4 +4,4 @@ CMTCONFIG=$2 source /cvmfs/sft.cern.ch/lcg/views/${LCG}/${CMTCONFIG}/setup.sh source build/INSTALL/thisostap.sh cd build -ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j4 --output-on-failure --test-output-size-failed=5000000 +ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j4 -R '(gof|stat)' --output-on-failure --test-output-size-failed=5000000 diff --git a/ostap/CMakeLists.txt b/ostap/CMakeLists.txt index c159bc99..01f078da 100644 --- a/ostap/CMakeLists.txt +++ b/ostap/CMakeLists.txt @@ -139,21 +139,21 @@ if ( ${PYTHON_VERSION} VERSION_GREATER_EQUAL "3.7" ) message ( "----> warning (optional) lmdb is NOT found!" ) endif() endif() -endif() - +endif() + # ======================================================================================= ## joblib: run some numpy-related code in parallel # ======================================================================================= - -find_python_module ( joblib QUIET ) -if ( NOT ${PY_joblib_FOUND} ) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install joblib ${PIP_ARGS}) -endif() -find_python_module ( joblib QUIET ) -if ( NOT ${PY_joblib_FOUND} ) - message ( "----> warning (optional) joblib is NOT found!" ) -endif() - +if ( ${PYTHON_VERSION} VERSION_GREATER_EQUAL "3.0" ) + find_python_module ( joblib QUIET ) + if ( NOT ${PY_joblib_FOUND} ) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install joblib ${PIP_ARGS}) + endif() + find_python_module ( joblib QUIET ) + if ( NOT ${PY_joblib_FOUND} ) + message ( "----> warning (optional) joblib is NOT found!" ) + endif() + endif() # ======================================================================================== ## terminaltables3 & terminaltables # ======================================================================================== diff --git a/ostap/stats/gof_np.py b/ostap/stats/gof_np.py index c2eeb367..29f88b0d 100644 --- a/ostap/stats/gof_np.py +++ b/ostap/stats/gof_np.py @@ -23,6 +23,7 @@ 'PPDNP' , ## Point-to-Point Dissimilarity Goodness-of-fit method ) # ============================================================================= +from ostap.core.meta_info import python_info from ostap.core.ostap_types import string_types from ostap.stats.gof import normalize2 from ostap.core.core import SE, VE @@ -207,12 +208,21 @@ def psi_conf ( psi , scale = 1.0 ) : raise TypeError ( "Unknown `psi':%s" % psi ) -try : - import joblib as jl -except ImportError : - jl = None -# ===================================================================== +# ============================================================================= +jl = None +# ============================================================================= +try : # ======================================================================= + # ========================================================================= + if ( 3 , 0 ) <= python_info : + with warnings.catch_warnings(): + warnings.simplefilter ( "ignore" , category = DeprecationWarning ) + import joblib as jl + # ========================================================================= +except ImportError : # ======================================================== + # ========================================================================= + jl = None +# ============================================================================= ## @class PERMUTATOR # Helper class that allow to run permutattion test in parallel class PERMUTATOR(object) : @@ -240,7 +250,7 @@ def __call__ ( self , N , silent = True ) : return counter # ============================================================================= -if jl : # ===================================================================== +if jl and ( 3 , 0 ) <= python_info : # ======================================== # ========================================================================= ## Run NN-permutations in parallel using joblib def joblib_run ( self , NN , silent = True ) : @@ -253,8 +263,8 @@ def joblib_run ( self , NN , silent = True ) : elif '1.4.0' <= jl.__version__ : conf [ 'return_as' ] = 'unordered_generator' ## input = ( jl.delayed (self)( N ) for N in lst ) - results = jl.Parallel ( **conf ) ( input ) counter = EffCounter() + results = jl.Parallel ( **conf ) ( input ) for r in progress_bar ( results , max_value = nj , silent = silent ) : counter += r #