Skip to content

Commit 0e9fbd9

Browse files
mdkofacebook-github-bot
authored andcommitted
Add initializer for 'score' Reporter, so it doesn't throw when the set of jobs reported is empty
Summary: Trying out benchpress submcommands, I saw that running "report score" causes an exception since no jobs have caused the Score reporter's `report()` method to have run, thus the `scores` dict attribute was non-existent. Reviewed By: excelle08, charles-typ Differential Revision: D83201105
1 parent 4654b85 commit 0e9fbd9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

benchpress/lib/reporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ def close(self):
8888
class ScoreReporter(Reporter):
8989
"""Report scores of benchmarks as well as overall DCPerf score"""
9090

91+
def __init__(self) -> None:
92+
self.scores = {}
93+
9194
def report(self, job, metrics):
92-
if not hasattr(self, "scores"):
93-
self.scores = {}
9495
job_name = job.name.replace(" ", "_")
9596

9697
if job_name not in baseline.JOB_TO_BM.keys():

0 commit comments

Comments
 (0)