From 980bd36d02fba2aa4b6fe960dbd553c2126c2904 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Sun, 17 Apr 2022 14:58:49 +0300 Subject: [PATCH] Stop running StageMWM when any country was failed. Signed-off-by: Viktor Govako --- .../python/maps_generator/generator/stages_declaration.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/python/maps_generator/generator/stages_declaration.py b/tools/python/maps_generator/generator/stages_declaration.py index 155b37169..ff6fff6f4 100644 --- a/tools/python/maps_generator/generator/stages_declaration.py +++ b/tools/python/maps_generator/generator/stages_declaration.py @@ -12,7 +12,7 @@ import os import shutil import tarfile from collections import defaultdict -from multiprocessing.pool import ThreadPool +from concurrent.futures import ThreadPoolExecutor, as_completed from typing import AnyStr from typing import Type @@ -173,11 +173,10 @@ class StageMwm(Stage): tmp_mwm_names = env.get_tmp_mwm_names() if len(tmp_mwm_names): logger.info(f'Number of feature data .mwm.tmp country files to process: {len(tmp_mwm_names)}') - with ThreadPool(settings.THREADS_COUNT) as pool: + with ThreadPoolExecutor(settings.THREADS_COUNT) as pool: pool.map( lambda c: StageMwm.make_mwm(c, env), - tmp_mwm_names, - chunksize=1, + tmp_mwm_names ) else: # TODO: list all countries that were not found?