aboutsummaryrefslogtreecommitdiff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-02 12:25:58 -0500
committerFrederick Muriuki Muriithi2025-06-02 12:32:09 -0500
commitf0b0e04bb6aa1744c802d4eb5cd1cb7c84c88b02 (patch)
tree3e1d10c3e053ba34248cf07702875de85b8d8d6d /uploader
parente3e097af4b92173e2bcb4771ccd1360fbe0e8cf6 (diff)
downloadgn-uploader-f0b0e04bb6aa1744c802d4eb5cd1cb7c84c88b02.tar.gz
Add some debugging statements.
Diffstat (limited to 'uploader')
-rw-r--r--uploader/phenotypes/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/uploader/phenotypes/models.py b/uploader/phenotypes/models.py
index eb926d8..f4d3529 100644
--- a/uploader/phenotypes/models.py
+++ b/uploader/phenotypes/models.py
@@ -336,12 +336,14 @@ def save_phenotypes_data(
}[table]
saved_data = tuple()
with conn.cursor(cursorclass=DictCursor) as cursor:
+ _count = 0
while True:
batch = take(data, 5000):
if len(batch) == 0:
logger.warning("Got an empty batch. This needs investigation.")
break
+ logger.debug("Saving batch of %s items.", len(batch))
cursor.executemany(
(f"INSERT INTO {_table_details['table']}"
f"({_table_details['DataIdCol']}, StrainId, {_table_details['valueCol']}) "
@@ -359,5 +361,8 @@ def save_phenotypes_data(
for item in batch)
for single in items))
saved_data = saved_data + tuple(dict(row) for row in cursor.fetchall())
+ _count = _count + len(batch)
+
+ logger.debug("Saved a total of %s data rows", _count)
return saved_data