From d617a60450a88528a76d2f13e45f81851bf427d9 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 12 Jun 2024 18:44:34 +0300 Subject: Log how long it takes to run the indexing script. Signed-off-by: Munyoki Kilyungi --- scripts/index-genenetwork | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/index-genenetwork') diff --git a/scripts/index-genenetwork b/scripts/index-genenetwork index ec203e2..9786134 100755 --- a/scripts/index-genenetwork +++ b/scripts/index-genenetwork @@ -10,6 +10,8 @@ through the web interface. """ from collections import deque, namedtuple import contextlib +import time +import datetime from functools import partial import itertools import json @@ -489,6 +491,7 @@ def create_xapian_index(xapian_directory: str, sql_uri: str, xapian_directory) sys.exit(1) + start_time = time.perf_counter() with temporary_directory("combined", xapian_directory) as combined_index: with temporary_directory("build", xapian_directory) as xapian_build_directory: logging.info("Indexing genes") @@ -515,6 +518,9 @@ def create_xapian_index(xapian_directory: str, sql_uri: str, for child in combined_index.iterdir(): shutil.move(child, pathlib.Path(xapian_directory) / child.name) logging.info("Index built") + end_time = time.perf_counter() + index_time = datetime.timedelta(seconds=end_time - start_time) + logging.info(f"Time to Index: {index_time}") @click.group() -- cgit v1.2.3