diff --git a/ostap/parallel/tests/test_parallel_ipyparallel.py b/ostap/parallel/tests/test_parallel_ipyparallel.py index 6462d3d0..6ca0e43f 100644 --- a/ostap/parallel/tests/test_parallel_ipyparallel.py +++ b/ostap/parallel/tests/test_parallel_ipyparallel.py @@ -91,15 +91,16 @@ def test_ipyparallel_function () : result = None with warnings.catch_warnings() : warnings.simplefilter('ignore', category=UserWarning) - with ipp.Cluster () as cluster : - - view = cluster.load_balanced_view() - results = view.map_async ( make_histos , zip ( count () , inputs ) ) + cluster = ipp.Cluster () + with cluster : + + view = cluster.load_balanced_view() + results = view.map_async ( make_histos , zip ( count () , inputs ) ) + + for r in progress_bar ( results ) : + if not result : result = r + else : result.Add ( r ) - for r in progress_bar ( results ) : - if not result : result = r - else : result.Add ( r ) - with use_canvas ( 'test_ipyparallel_function' , wait = 2 ) : logger.info ( "Histogram is %s" % result.dump ( 80 , 20 ) ) logger.info ( "Entries %s/%s" % ( result.GetEntries() , sum ( inputs ) ) ) @@ -134,17 +135,18 @@ def test_ipyparallel_callable () : result = None with warnings.catch_warnings() : warnings.simplefilter('ignore', category=UserWarning) - with ipp.Cluster () as cluster : - - ##view = cluster.load_balanced_view() - view = cluster[:] - view.use_dill() - - results = view.map_async ( mh , zip ( count () , inputs ) ) - - for r in progress_bar ( results ) : - if not result : result = r - else : result.Add ( r ) + cluster = ipp.Cluster () + with cluster : + + ##view = cluster.load_balanced_view() + view = cluster[:] + view.use_dill() + + results = view.map_async ( mh , zip ( count () , inputs ) ) + + for r in progress_bar ( results ) : + if not result : result = r + else : result.Add ( r ) with use_canvas ( 'test_ipyparallel_function' , wait = 2 ) : logger.info ( "Histogram is %s" % result.dump ( 80 , 20 ) )