From e232d4278ba1147552e4156eba51cd4eb5cb923b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Thu, 27 Jan 2022 12:35:35 +0000
Subject: [PATCH] add logging img fetch time

---
 aliby/baby_client.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/aliby/baby_client.py b/aliby/baby_client.py
index 1b36a5df..b889d4fc 100644
--- a/aliby/baby_client.py
+++ b/aliby/baby_client.py
@@ -4,6 +4,7 @@ import json
 import time
 from pathlib import Path
 from typing import Iterable
+from time import perf_counter
 
 import h5py
 import numpy as np
@@ -24,6 +25,8 @@ from requests_toolbelt.multipart.encoder import MultipartEncoder
 from agora.io.utils import Cache, accumulate, get_store_path
 
 
+import logging
+
 ################### Dask Methods ################################
 def format_segmentation(segmentation, tp):
     """Format a single timepoint into a dictionary.
@@ -141,10 +144,14 @@ class BabyRunner:
     def run_tp(self, tp, with_edgemasks=True, assign_mothers=True, **kwargs):
         """Simulating processing time with sleep"""
         # Access the image
+        t = perf_counter()
         img = self.get_data(tp)
+        logging.debug(f"Timing:BF_fetch:{perf_counter()-t}s")
+        t = perf_counter()
         segmentation = self.crawler.step(
             img, with_edgemasks=with_edgemasks, assign_mothers=assign_mothers, **kwargs
         )
+        logging.debug(f"Timing:crawler_step:{perf_counter()-t}s")
         return format_segmentation(segmentation, tp)
 
 
-- 
GitLab