Skip to content

Commit

Permalink
Benchmarks were being published twice (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed Jul 23, 2021
1 parent 2a570bd commit 5008a83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ class CasesBenchmark(conbench.runner.Benchmark):
tags=tags,
options=kwargs,
)
self.conbench.publish(benchmark)
yield benchmark, output

def _get_benchmark_function(self, rows, columns):
Expand Down
11 changes: 7 additions & 4 deletions conbench/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def github_info(self):
def machine_info(self):
return machine_info(self.config.host_name)

def benchmark(self, f, name, **kwargs):
def benchmark(self, f, name, publish=True, **kwargs):
"""Benchmark a function and publish the result."""
tags, context, github, options, _ = self._init(kwargs)

Expand All @@ -154,11 +154,13 @@ def benchmark(self, f, name, **kwargs):
context=context,
github=github,
options=options,
publish=False,
)
self.publish(benchmark)
if publish:
self.publish(benchmark)
return benchmark, output

def record(self, result, name, **kwargs):
def record(self, result, name, publish=True, **kwargs):
"""Record and publish an external benchmark result."""
tags, context, github, options, output = self._init(kwargs)

Expand Down Expand Up @@ -189,7 +191,8 @@ def record(self, result, name, **kwargs):
if run_name is not None:
benchmark["run_name"] = run_name

self.publish(benchmark)
if publish:
self.publish(benchmark)
return benchmark, output

def mark_new_batch(self):
Expand Down
1 change: 0 additions & 1 deletion conbench/tests/benchmark/_example_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def run(self, case=None, **kwargs):
tags=tags,
options=kwargs,
)
self.conbench.publish(benchmark)
yield benchmark, output

def _get_benchmark_function(self, rows, columns):
Expand Down

0 comments on commit 5008a83

Please sign in to comment.