From 99f81b8c9675d293561e3c8f06cf0fddd33dce16 Mon Sep 17 00:00:00 2001 From: pswain <peter.swain@ed.ac.uk> Date: Thu, 25 Apr 2024 17:28:44 +0100 Subject: [PATCH] minor tweaks --- src/agora/abc.py | 2 +- src/agora/logging.py | 16 ---------------- src/aliby/pipeline.py | 9 ++++++--- 3 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 src/agora/logging.py diff --git a/src/agora/abc.py b/src/agora/abc.py index 42c37db..394f7bd 100644 --- a/src/agora/abc.py +++ b/src/agora/abc.py @@ -10,7 +10,7 @@ from typing import Union from flatten_dict import flatten, unflatten from yaml import dump, safe_load -from agora.logging import timer +from agora.logging_timer import timer atomic = t.Union[int, float, str, bool] diff --git a/src/agora/logging.py b/src/agora/logging.py deleted file mode 100644 index 6eb1bea..0000000 --- a/src/agora/logging.py +++ /dev/null @@ -1,16 +0,0 @@ -import logging -from time import perf_counter - - -def timer(func): - """Log duration of a function into the aliby log file.""" - - def wrap_func(*args, **kwargs): - t1 = perf_counter() - result = func(*args, **kwargs) - logging.getLogger("aliby").debug( - f"{func.__qualname__} took {(perf_counter()-t1):.4f}s" - ) - return result - - return wrap_func diff --git a/src/aliby/pipeline.py b/src/aliby/pipeline.py index 56ab553..37a4182 100644 --- a/src/aliby/pipeline.py +++ b/src/aliby/pipeline.py @@ -420,13 +420,13 @@ class Pipeline(ProcessABC): tiler.tile_size, ) if frac_clogged_traps > 0.3: - self.log(f"{name}:Clogged_traps:{frac_clogged_traps}") + self.log(f"{name}: Clogged_traps:{frac_clogged_traps}") frac = np.round(frac_clogged_traps * 100) progress_bar.set_postfix_str(f"{frac} Clogged") else: # stop if too many clogged traps self.log( - f"{name}:Stopped early at time {i} with {frac_clogged_traps} clogged traps" + f"{name}: Stopped early at time {i} with {frac_clogged_traps} clogged traps" ) break # run post-processing @@ -434,7 +434,10 @@ class Pipeline(ProcessABC): out_file, PostProcessorParameters.from_dict(config["postprocessing"]), ).run() - self.log("Analysis finished successfully.", "info") + self.log( + f"{config['tiler']['position_name']}: Analysis finished successfully.", + "info", + ) return 1 @property -- GitLab