From 9f2b77bf1dbf09fcfa88fcfd5e5863b3e83f890c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 24 Jul 2023 13:14:42 +0300 Subject: [PATCH] More compact parsing report to terminal --- parsers/logbooks.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index e701183..8d2f969 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -57,7 +57,7 @@ LOGBOOK_PARSER_SETTINGS = { LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB ENTRIES = { - "2023": 27, + "2023": 32, "2022": 90, "2019": 55, "2018": 95, @@ -305,8 +305,8 @@ def parser_html(year, expedition, txt, seq=""): endmatch = re.match(r"(?i)(?s).*([\s\S]*?)(?= 0: + print(f"\n - {year} endpara:\n'{endpara}'") endpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "endmatter.html") with open(endpath, "w") as end: end.write(endpara + "\n") @@ -560,7 +560,8 @@ def parse_logbook_for_expedition(expedition, blog=False): if logbook_parseable: # -------------------- parser = globals()[parsefunc] - print(f" - {year} parsing with {parsefunc} - {lb}") + # print(f" - {year} parsing with {parsefunc} - {lb}") + print(" .", end="") logentries = parser(year, expedition, txt, sq) # this launches the right parser # -------------------- @@ -665,7 +666,7 @@ def LoadLogbooks(): logentries = parse_logbook_for_expedition(b, blog=True) # loads the blog logbook for one expo allentries += logentries - print(f"total {len(allentries):,} log entries parsed in all expeditions") + print(f"\ntotal {len(allentries):,} log entries parsed in all expeditions") mem = get_process_memory() print(f" - MEM: {mem:7.2f} MB in use, {mem-mem1:7.2f} MB more", file=sys.stderr) duration = time.time() - start @@ -682,6 +683,7 @@ def LoadLogbooks(): for expo in expos: expo.save() # to save logbook name property mem = get_process_memory() + print(f"total {len(allentries):,} log entries saved into database") print(f" - MEM: {mem:7.2f} MB in use, {mem-mem1:7.2f} MB more", file=sys.stderr) duration = time.time() - start print(f" - TIME: {duration:7.2f} s", file=sys.stderr)