diff --git a/src/agora/abc.py b/src/agora/abc.py index 42c37db7467852d40562369a6f6e06255d045876..394f7bdbaba773c03e3b72f43b092301004f1202 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 6eb1bea655c355ea8fa07dd157f602ac2444a645..0000000000000000000000000000000000000000 --- 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 56ab553fc0258124d2cc2275c51ee505720761a0..37a4182a9f25c4b9ca81b359b369571cbafe6040 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