Skip to content

Commit

Permalink
disable parallel processing for soem cases
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Apr 25, 2024
1 parent 81fa7bb commit 6844564
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ostap/parallel/parallel_add_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'add_new_branch' , ## add new branch to loooong TChain in parallel
)
# =============================================================================
from ostap.core.meta_info import root_info, python_info
from ostap.parallel.parallel import Task, WorkManager
import ostap.parallel.parallel_statvar
import ROOT
Expand Down Expand Up @@ -83,6 +84,10 @@ def add_new_branch ( chain ,
"""
from ostap.trees.trees import Chain
from ostap.trees.trees import add_new_branch as _add_branch_

if ( 6 , 18 ) <= root_info < ( 6, 19) and python_info < ( 3 , 0 ) :
if verbose : logger.info ( 'Switch to sequential processing...' )
return _add_branch_ ( chain , branch_name , function , verbose = verbose , report = report )

if isinstance ( chain , ROOT.TChain ) and 1 < len ( chain.files () ) : pass
elif isinstance ( chain , ROOT.TTree ) :
Expand Down
9 changes: 9 additions & 0 deletions ostap/parallel/parallel_pathos.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,15 @@ def iexecute ( self , job , jobs_args , progress = False ) :
- no summary prin
- no merging of results
"""

print ('IEXCUTE', job, type ( job ) , jobs_args )
import ostap.parallel.parallel as P
print ( 'IEXECUTE/A' , type ( jobs_args), P.pickles ( jobs_args ) )
print ( 'IEXECUTE/J' , job , type ( job), P.pickles ( job ) )

print ( 'BADOBNJECTS' , P.dill.detect.badobjects ( job ) )
print ( 'BADTYPES' , P.dill.detect.badtypes ( job ) )
print ( 'ERRORS' , P.dill.detect.errors ( job ) )

with pool_context ( self.pool ) as pool :

Expand Down
5 changes: 1 addition & 4 deletions ostap/parallel/parallel_statvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ def pStatVar ( chain ,
"""
## few special/trivial cases


print ( 'I AM PSTATVAR/0 ' , root_info , python_info, ( 6 , 18 ) <= root_info, root_info < ( 6 , 19 ) , ( 6 , 18 ) <= root_info < ( 6 , 19 ) , python_info < ( 3 , 0 ) )

from ostap.trees.trees import _stat_vars_
last = min ( n_large , first + nevents if 0 < nevents else n_large )

Expand All @@ -140,7 +137,7 @@ def pStatVar ( chain ,
elif isinstance ( chain , ROOT.TTree ) and len ( chain ) < chunk_size :
return chain.statVar ( what , cuts , first , last )
elif ( 6 , 18 ) <= root_info < ( 6 , 19 ) and python_info < ( 3 , 0 ) :
print ( 'I AM PSTATVAR/1 ' )
if not silent : logger.info ( 'Switch to seqential processing...' )
return chain.statVar ( what , cuts , first , last )

from ostap.trees.trees import Chain
Expand Down

0 comments on commit 6844564

Please sign in to comment.