diff --git a/test/integration/cache/test_parallel_cache_files.py b/test/integration/cache/test_cache_parallel.py similarity index 54% rename from test/integration/cache/test_parallel_cache_files.py rename to test/integration/cache/test_cache_parallel.py index c8abe8c3af..a463f3614d 100644 --- a/test/integration/cache/test_parallel_cache_files.py +++ b/test/integration/cache/test_cache_parallel.py @@ -18,7 +18,7 @@ def get_unused_pid() -> int: return -1 -def test_parallel_cache_files(): +def test_prev_cache_parallel_deletion(): # all files cache files in test dir must be removed # if `cache_dir` api param wasn't specified explicitly unused_test_pid = get_unused_pid() @@ -27,10 +27,12 @@ def test_parallel_cache_files(): test_file_2 = Path(default_fedot_data_dir(), f'cache_{unused_test_pid}.preprocessors_db') test_file_2.touch() + common_params = dict(timeout=0.1, with_tuning=False) + tasks = [ - delayed(run_regression_example)(with_tuning=False), - delayed(run_classification_example)(timeout=1., with_tuning=False), - delayed(run_ts_forecasting_example)(dataset='beer', horizon=10, timeout=1., with_tuning=False), + delayed(run_regression_example)(**common_params, preset='fast_train'), + delayed(run_classification_example)(**common_params), + delayed(run_ts_forecasting_example)(**common_params, dataset='beer', horizon=10), ] cpus = cpu_count() @@ -41,3 +43,24 @@ def test_parallel_cache_files(): assert False, 'DBs collides' assert not test_file_1.exists() assert not test_file_2.exists() + + +def test_parallel_cache_files(): + # all files cache files in test dir must be removed + # if `cache_dir` api param wasn't specified explicitly + data_dir = Path(default_fedot_data_dir()) + common_params = dict(timeout=0.1, with_tuning=False) + + tasks = [ + delayed(run_regression_example)(**common_params, preset='fast_train'), + delayed(run_classification_example)(**common_params), + delayed(run_ts_forecasting_example)(**common_params, dataset='beer', horizon=10), + ] + + cpus = cpu_count() + if cpus > 1: + try: + Parallel(n_jobs=cpus)(tasks) + except sqlite3.OperationalError: + assert False, 'DBs collides' + assert len(list(data_dir.glob('cache_*.*'))) == 6 # (operations_cache, preprocessing_cache) x 3