Skip to content
Snippets Groups Projects
Commit c846a7fe authored by leufen1's avatar leufen1
Browse files

adjusted preprocessing tests

parent 92763f13
No related branches found
No related tags found
6 merge requests!319add all changes of dev into release v1.4.0 branch,!318Resolve "release v1.4.0",!317enabled window_lead_time=1,!301Resolve "TECH: max number of parallel processes",!295Resolve "data handler FIR filter",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #68753 passed
......@@ -66,5 +66,5 @@ def default_session_fixture(request):
# request.addfinalizer(unpatch)
with mock.patch("multiprocessing.cpu_count", return_value=1):
with mock.patch("psutil.cpu_count", return_value=1):
yield
......@@ -245,7 +245,7 @@ class PreProcessing(RunEnvironment):
max_process = self.data_store.get("max_number_multiprocessing")
n_process = min([psutil.cpu_count(logical=False), len(set_stations), max_process]) # use only physical cpus
if n_process > 1 and use_multiprocessing: # parallel solution
if n_process > 1 and use_multiprocessing is True: # parallel solution
logging.info("use parallel validate station approach")
pool = multiprocessing.Pool(n_process)
logging.info(f"running {getattr(pool, '_processes')} processes in parallel")
......
......@@ -109,7 +109,7 @@ class TestPreProcessing:
assert caplog.record_tuples[-1] == ('root', 20, PyTestRegex(r'run for \d+:\d+:\d+ \(hh:mm:ss\) to check 6 '
r'station\(s\). Found 5/6 valid stations.'))
@mock.patch("multiprocessing.cpu_count", return_value=3)
@mock.patch("psutil.cpu_count", return_value=3)
@mock.patch("multiprocessing.Pool", return_value=multiprocessing.Pool(3))
def test_validate_station_parallel(self, mock_pool, mock_cpu, caplog, obj_with_exp_setup):
pre = obj_with_exp_setup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment