From 6ccec8254734311ccdf2c9175c49a22adab471a2 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Sat, 30 Dec 2023 13:21:45 +0800 Subject: [PATCH] tweaks --- csst_common/pipeline.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/csst_common/pipeline.py b/csst_common/pipeline.py index 5fad3af..c8f0624 100644 --- a/csst_common/pipeline.py +++ b/csst_common/pipeline.py @@ -150,11 +150,11 @@ class Pipeline: h.set("CREATED", self.pipeline_id, comment="pipeline build time") return reformat_header(h, strip=False, comment="Pipeline summary") - def summary(self): + def summarize(self): """Summarize this run.""" t_stop: Time = Time.now() t_cost: float = (t_stop - self.t_start).value * 86400.0 - self.pipeline_logger.info(f"Total cost: {t_cost} sec") + self.pipeline_logger.info(f"Total cost: {t_cost:.1f} sec") def clean_output(self): """Clean output directory.""" @@ -294,10 +294,10 @@ class Message: for d in dlist: f.write(self.dict2msg(d) + "\n") - def preview(self, dlist: list[dict]) -> str: - """Preview messages.""" + def preview(self, dlist: list[dict], n: int = 10) -> None: + """Preview top `n` messages.""" s = "" - for d in dlist: + for d in dlist[:n]: s += self.dict2msg(d) + "\n" print(s) -- GitLab