From 3c3bb8fd8200ace8d66236d9fcc795f0e8d48f99 Mon Sep 17 00:00:00 2001 From: "pierre.delaunay" Date: Wed, 26 Jun 2024 10:12:30 -0400 Subject: [PATCH] Reduce printed error when making reports --- benchmate/benchmate/warden.py | 5 +++-- milabench/commands/__init__.py | 2 +- milabench/pack.py | 3 +-- milabench/report.py | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/benchmate/benchmate/warden.py b/benchmate/benchmate/warden.py index d96775fcb..5b551464a 100644 --- a/benchmate/benchmate/warden.py +++ b/benchmate/benchmate/warden.py @@ -177,8 +177,6 @@ def handler(self, sig, frame): # and make the program stop self.restore_handlers() - self.stop() - def restore_handlers(self): """Restore old signal handlers""" if not self.signal_installed: @@ -189,6 +187,9 @@ def restore_handlers(self): self.signal_installed = False + # Cleanup now + self.stop() + def maybe_stop(self): """Raise the delayed signal if any or restore the old signal handlers""" diff --git a/milabench/commands/__init__.py b/milabench/commands/__init__.py index 58630681f..a1c6da78a 100644 --- a/milabench/commands/__init__.py +++ b/milabench/commands/__init__.py @@ -659,7 +659,7 @@ def _argv(self, **_) -> List: else ["--multi_gpu"] ) - cpu_per_process = self.resolve_argument('--cpus_per_gpu') + cpu_per_process = self.pack.resolve_argument('--cpus_per_gpu') return [ # -- Run the command in the right venv # This could be inside the SSH Command diff --git a/milabench/pack.py b/milabench/pack.py index 8b484c48c..5b30d05b8 100644 --- a/milabench/pack.py +++ b/milabench/pack.py @@ -509,7 +509,7 @@ def build_run_plan(self) -> "cmd.Command": def resolve_argument(self, name): """Resolve as single placeholder argument""" placeholder = str(self.config["argv"][name]) - return self.resolve_argument(placeholder) + return self.resolve_placeholder(placeholder) def resolve_placeholder(self, placeholder): """Resolve as single placeholder argument @@ -521,5 +521,4 @@ def resolve_placeholder(self, placeholder): """ from milabench.sizer import resolve_argv - return str(resolve_argv(self, [str(placeholder)])[0]) diff --git a/milabench/report.py b/milabench/report.py index 0611151c6..7e6ac502b 100644 --- a/milabench/report.py +++ b/milabench/report.py @@ -33,7 +33,7 @@ def _make_row(summary, compare, config, query=None): "enabled": is_enabled, } - if not summary: + if not summary or summary.get("empty", False): return row # Count not running an enabled benchmark as a failure @@ -218,7 +218,8 @@ def make_dataframe(summary, compare=None, weights=None, query=None): "n": 0, "successes": 0, "failures": 0, - "enabled": weights[key]["enabled"] + "enabled": weights[key]["enabled"], + "empty": True } if weights is None: