Skip to content
Snippets Groups Projects
Commit 99f81b8c authored by pswain's avatar pswain
Browse files

minor tweaks

parent 57379187
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ from typing import Union ...@@ -10,7 +10,7 @@ from typing import Union
from flatten_dict import flatten, unflatten from flatten_dict import flatten, unflatten
from yaml import dump, safe_load from yaml import dump, safe_load
from agora.logging import timer from agora.logging_timer import timer
atomic = t.Union[int, float, str, bool] atomic = t.Union[int, float, str, bool]
......
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
...@@ -420,13 +420,13 @@ class Pipeline(ProcessABC): ...@@ -420,13 +420,13 @@ class Pipeline(ProcessABC):
tiler.tile_size, tiler.tile_size,
) )
if frac_clogged_traps > 0.3: 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) frac = np.round(frac_clogged_traps * 100)
progress_bar.set_postfix_str(f"{frac} Clogged") progress_bar.set_postfix_str(f"{frac} Clogged")
else: else:
# stop if too many clogged traps # stop if too many clogged traps
self.log( 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 break
# run post-processing # run post-processing
...@@ -434,7 +434,10 @@ class Pipeline(ProcessABC): ...@@ -434,7 +434,10 @@ class Pipeline(ProcessABC):
out_file, out_file,
PostProcessorParameters.from_dict(config["postprocessing"]), PostProcessorParameters.from_dict(config["postprocessing"]),
).run() ).run()
self.log("Analysis finished successfully.", "info") self.log(
f"{config['tiler']['position_name']}: Analysis finished successfully.",
"info",
)
return 1 return 1
@property @property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment