From d23a0abca288f038537f434f778cbf17768df1cc Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Wed, 1 May 2019 18:41:01 +0100 Subject: [PATCH] add logging for get_groups --- location/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/location/__init__.py b/location/__init__.py index a07a0d3..2dd696c 100644 --- a/location/__init__.py +++ b/location/__init__.py @@ -38,7 +38,7 @@ class Location(NamedTuple): alt: Optional[float] tag: Tag -dbcache = make_dbcache(CACHE_PATH, hashf=mtime_hash, type_=Location, chunk_by=10000) +dbcache = make_dbcache(CACHE_PATH, hashf=mtime_hash, type_=Location, chunk_by=10000, logger=get_logger()) def tagger(dt: datetime, point: geopy.Point) -> Tag: @@ -153,6 +153,8 @@ class Window: # TODO maybe if tag is none, we just don't care? def get_groups() -> List[LocInterval]: + logger = get_logger() + all_locations = iter(iter_locations()) # TODO locsi = Window(all_locations) i = 0 @@ -174,8 +176,9 @@ def get_groups() -> List[LocInterval]: curg = [] while locsi.exists(i): - # if i % 1000 == 0: - # print("processing " + str(i)) + if i % 10000 == 0: + logger.debug('grouping item %d', i) + locsi.consume_to(i) last = None if len(curg) == 0 else curg[-1]