Skip to content

Commit

Permalink
better logs
Browse files Browse the repository at this point in the history
  • Loading branch information
miili committed Sep 13, 2023
1 parent e26d5d2 commit b4ad55b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 5 additions & 2 deletions lassie/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ async def start(self, force_rundir: bool = False) -> None:
await self.prepare()
self.init_rundir(force_rundir)
logger.info("starting search...")
batch_processing_start = datetime_now()
processing_start = datetime_now()

if self._progress.time_progress:
Expand Down Expand Up @@ -262,7 +263,7 @@ async def start(self, force_rundir: bool = False) -> None:
if batch.i_batch % 50 == 0:
self._detections.dump_detections(jitter_location=self.octree.size_limit)

processing_time = datetime_now() - processing_start
processing_time = datetime_now() - batch_processing_start
self._batch_processing_durations.append(processing_time)
if batch.n_batches:
percent_processed = ((batch.i_batch + 1) / batch.n_batches) * 100
Expand All @@ -288,9 +289,11 @@ async def start(self, force_rundir: bool = False) -> None:
datetime.now() + remaining_time, # noqa: DTZ005
)

processing_start = datetime_now()
batch_processing_start = datetime_now()
self.set_progress(batch.end_time)

logger.info("finished search in %s", datetime_now() - processing_start)

async def add_features(self, event: EventDetection) -> None:
try:
squirrel = self.data_provider.get_squirrel()
Expand Down
10 changes: 1 addition & 9 deletions lassie/waveforms/squirrel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
from pathlib import Path
from typing import TYPE_CHECKING, AsyncIterator, Iterator, Literal

from pydantic import (
AwareDatetime,
PositiveInt,
PrivateAttr,
constr,
model_validator,
)
from pydantic import AwareDatetime, PositiveInt, PrivateAttr, constr, model_validator
from pyrocko.squirrel import Squirrel
from typing_extensions import Self

Expand Down Expand Up @@ -138,5 +132,3 @@ async def iter_batches(
)

prefetcher.queue.task_done()

logger.info("squirrel search finished")

0 comments on commit b4ad55b

Please sign in to comment.