Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation and narrower try/except in BenchmarkMetric #3100

Closed
wants to merge 1 commit into from

Conversation

esantorella
Copy link
Contributor

Summary:
Context:

BenchmarkMetric.fetch_data originally had a broad try/except block just because this the usual way to define metrics. The try/except is actually not needed at all; with benchmarking, there are no potentially-flaky RPCs and we completely understand what should happen when fetching data. BenchmarkMapMetric has no try/except. The following cases are possible when fetching data:

  • If the trial has not been run, it will have no metadata, and there should be a MetricFetchE (error).
  • If a trial has been run, it should have properly formatted metadata, and fetch_data should succeed.
  • If there is a problem with the metadata, this really shouldn't happen, and fetch_data should form with an informative error.

This PR:

  • Unifieds the logic between BenchmarkMetric and BenchmarkMapMetric so that both return a MetricFetchE when there is no metadata and do not have a try/except
  • Pulls out a mixin for code-sharing

Differential Revision: D66301697

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 21, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66301697

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.43%. Comparing base (5d1e441) to head (6d512ca).

Files with missing lines Patch % Lines
ax/benchmark/benchmark_metric.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3100      +/-   ##
==========================================
+ Coverage   95.41%   95.43%   +0.01%     
==========================================
  Files         495      495              
  Lines       49941    49956      +15     
==========================================
+ Hits        47653    47674      +21     
+ Misses       2288     2282       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Summary:

**Context**:

`BenchmarkMetric.fetch_data` originally had a broad try/except block just because this the usual way to define metrics. The try/except is actually not needed at all; with benchmarking, there are no potentially-flaky RPCs and we completely understand what should happen when fetching data; thus, `BenchmarkMapMetric` has no try/except. The following cases are possible when fetching data:
* If the trial has not been run, it will have no metadata, and there should be a `MetricFetchE` (error).
* If a trial has been run, it should have properly formatted metadata, and `fetch_data` should succeed.
* If there is a problem with the metadata, this really shouldn't happen, and `fetch_data` should form with an informative error.

**This PR**:
* Unifies the logic between `BenchmarkMetric` and `BenchmarkMapMetric` so that both return a `MetricFetchE` when there is no metadata and do not have a try/except
* Pulls out a mixin for code-sharing

Reviewed By: Balandat

Differential Revision: D66301697
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66301697

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 095d7ed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants