aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-06-12 18:44:34 +0300
committerBonfaceKilz2024-06-12 19:21:50 +0300
commitd617a60450a88528a76d2f13e45f81851bf427d9 (patch)
treeb4792a95c66062cc1735cf6c5d1dd4671481d40b
parent6ba1da4fb7184dd8036f7aaa2bd2171ed1e2faf0 (diff)
downloadgenenetwork3-d617a60450a88528a76d2f13e45f81851bf427d9.tar.gz
Log how long it takes to run the indexing script.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xscripts/index-genenetwork6
1 files changed, 6 insertions, 0 deletions
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()