Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMaksim Andrianov <maksimandrianov1@gmail.com>2019-06-06 12:49:49 +0300
committergmoryes <gmoryes@gmail.com>2019-06-06 15:08:25 +0300
commit61972e95a3eea5a2bd617a0e884dc951d5267e8f (patch)
treef51b9a658170d22ddb4b48e4f9c7e834ecb96241 /tools
parentc6a6c67340afb53a086d9ba4c00a3d6f0431515c (diff)
[python] Some fixes.
Diffstat (limited to 'tools')
-rw-r--r--tools/python/maps_generator/generator/decorators.py2
-rw-r--r--tools/python/maps_generator/generator/statistics.py6
-rw-r--r--tools/python/maps_generator/maps_generator.py2
-rwxr-xr-xtools/python/post_generation/hierarchy_to_countries.py2
4 files changed, 7 insertions, 5 deletions
diff --git a/tools/python/maps_generator/generator/decorators.py b/tools/python/maps_generator/generator/decorators.py
index aba32092ea..e465b686b5 100644
--- a/tools/python/maps_generator/generator/decorators.py
+++ b/tools/python/maps_generator/generator/decorators.py
@@ -30,7 +30,7 @@ def stage(func):
main_status.update_status()
logger.info(f"{stage_formatted}: start ...")
t = time.time()
- with open(logfile, "w") as l:
+ with open(logfile, "a+") as l:
env.set_subprocess_out(l)
func(env, *args, **kwargs)
d = time.time() - t
diff --git a/tools/python/maps_generator/generator/statistics.py b/tools/python/maps_generator/generator/statistics.py
index bca18696c6..00438c76f4 100644
--- a/tools/python/maps_generator/generator/statistics.py
+++ b/tools/python/maps_generator/generator/statistics.py
@@ -106,7 +106,9 @@ def parse_time(time_str):
return datetime.timedelta(**time_params)
-def get_stages_info(log_path):
+def get_stages_info(log_path, ignored_stages=None):
+ if ignored_stages is None:
+ ignored_stages = set()
result = defaultdict(lambda: defaultdict(dict))
for file in os.listdir(log_path):
path = os.path.join(log_path, file)
@@ -117,7 +119,7 @@ def get_stages_info(log_path):
continue
stage_name = m.group(2)
dt = parse_time(m.group(3))
- if file.startswith("stage_"):
+ if file.startswith("stage_") and stage_name not in ignored_stages:
result["stages"][stage_name] = dt
else:
country = file.split(".")[0]
diff --git a/tools/python/maps_generator/maps_generator.py b/tools/python/maps_generator/maps_generator.py
index 3a7ee4f1ad..eff4bb5c71 100644
--- a/tools/python/maps_generator/maps_generator.py
+++ b/tools/python/maps_generator/maps_generator.py
@@ -290,7 +290,7 @@ def stage_statistics(env):
countries = filter(lambda x: x not in WORLDS_NAMES, mwms)
with ThreadPool() as pool:
pool.map(partial(stage_mwm_statistics, env), countries)
- stages_info = get_stages_info(env.log_path)
+ stages_info = get_stages_info(env.log_path, {"statistics"})
result["stages"] = stages_info["stages"]
for c in stages_info["countries"]:
result["countries"][c]["stages"] = stages_info["countries"][c]
diff --git a/tools/python/post_generation/hierarchy_to_countries.py b/tools/python/post_generation/hierarchy_to_countries.py
index b2c518e758..e1915827bf 100755
--- a/tools/python/post_generation/hierarchy_to_countries.py
+++ b/tools/python/post_generation/hierarchy_to_countries.py
@@ -140,7 +140,7 @@ def hierarchy_to_countries(old_vs_new_csv_path, borders_vs_osm_csv_path,
oldvs = parse_old_vs_new(old_vs_new_csv_path)
vsosm = parse_borders_vs_osm(borders_vs_osm_csv_path)
countries_synonyms = parse_countries_synonyms(countries_synonyms_csv_path)
- stack = [CountryDict(v=version, nameattr="Countries", g=[])]
+ stack = [CountryDict(v=version, id="Countries", g=[])]
last = None
with open(hierarchy_path) as f:
for line in f: