Skip to content

Commit 03e5889

Browse files
committed
Add --log-level argument
1 parent c3dcf5c commit 03e5889

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

dpbench/console/_namespace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class Namespace(argparse.Namespace):
3131
program: str
3232
color: str
3333
comparisons: list[str]
34+
log_level: str
3435
skip_expected_failures: bool
3536

3637

dpbench/console/entry.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""Entry point for dpbench cli tool."""
66

77
import argparse
8+
import logging
89
from importlib.metadata import version
910

1011
from ._namespace import (
@@ -74,6 +75,14 @@ def parse_args() -> Namespace:
7475
default="results.db",
7576
help="Path to a database to store results.",
7677
)
78+
parser.add_argument(
79+
"--log-level",
80+
type=str,
81+
choices=["critical", "fatal", "error", "warning", "info", "debug"],
82+
nargs="?",
83+
default="warning",
84+
help="Log level.",
85+
)
7786

7887
subparsers = parser.add_subparsers(dest="program")
7988

@@ -104,6 +113,8 @@ def main():
104113
"""Main function to run on dpbench console tool."""
105114
args = parse_args()
106115

116+
logging.root.setLevel(args.log_level.upper())
117+
107118
conn = None
108119
if args.program == "report" or args.program == "run" and args.save:
109120
import dpbench.infrastructure as dpbi

dpbench/infrastructure/benchmark.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ def _set_reference_implementation(self) -> BenchmarkImplFn:
371371
]
372372

373373
if len(reference_implementations) == 0:
374-
raise RuntimeError("No reference implementation")
374+
logging.warn("No reference implementation")
375+
return None
375376

376377
return reference_implementations[0]
377378

@@ -435,7 +436,8 @@ def _validate_results(self, preset, frmwrk, frmwrk_out, precision):
435436
).format(key, ref_out[key], frmwrk_out[key])
436437
)
437438
return valid
438-
except Exception:
439+
except Exception as e:
440+
logging.error(f"Exception during validation {e.args}")
439441
return False
440442

441443
def __init__(

dpbench/infrastructure/reporter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,10 @@ def get_unexpected_failures(
319319

320320
failures = {f for f in get_failures_from_results(results_db, run_id)}
321321

322+
fixed_failures = expected_failures.difference(failures)
323+
if len(fixed_failures):
324+
logging.warn(
325+
f"these benchmarks does not fail anymore: {fixed_failures}"
326+
)
327+
322328
return failures.difference(expected_failures)

dpbench/migrations/env.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from logging.config import fileConfig
6-
75
from alembic import context
86
from sqlalchemy import engine_from_config, pool
97

@@ -14,11 +12,6 @@
1412
# access to the values within the .ini file in use.
1513
config = context.config
1614

17-
# Interpret the config file for Python logging.
18-
# This line sets up loggers basically.
19-
if config.config_file_name is not None:
20-
fileConfig(config.config_file_name)
21-
2215
# add your model's MetaData object here
2316
# for 'autogenerate' support
2417
# from myapp import mymodel

0 commit comments

Comments
 (0)