File tree Expand file tree Collapse file tree
ft-analyzer/ftanalyzer/common
ft-orchestration/src/probe Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88"""
99
1010import logging
11+ import sys
1112import time
1213import os
14+ import pandas as pd
1315from functools import partial
1416from typing import Callable , List
15- import concurrent .futures
17+ from concurrent .futures import ProcessPoolExecutor , ThreadPoolExecutor
1618
17- import pandas as pd
19+ EXECUTOR_CLS = ThreadPoolExecutor if sys . gettrace () is not None else ProcessPoolExecutor
1820
1921# Max processes to create in multiprocessing pool.
2022# It helps to reduce RAM usage. For example,
@@ -37,7 +39,7 @@ def __enter__(self):
3739 proc_count = os .cpu_count ()
3840 proc_count = int (min (proc_count , MAX_PROC_COUNT ))
3941 logging .getLogger ().debug ("Setting up pool with %d processes." , proc_count )
40- self ._pool = concurrent . futures . ProcessPoolExecutor (max_workers = proc_count )
42+ self ._pool = EXECUTOR_CLS (max_workers = proc_count )
4143 self ._number_of_chunks = proc_count * 4
4244 return self
4345
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ def stop(self):
7373 return
7474
7575 logging .warning ("you can stop the probe now" )
76- wait_time = max ( self ._timeouts )
76+ wait_time = self ._timeouts [ 1 ] # inactive timeout is enough
7777 for i in range (wait_time , - 1 , - 1 ):
7878 logging .info (i )
7979 time .sleep (1 )
You can’t perform that action at this time.
0 commit comments