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

Ax Trial: Bug fix for error message that references nonexistent function #2304

Closed
wants to merge 1 commit into from

Conversation

esantorella
Copy link
Contributor

Summary:
BaseTrial._validate_can_attach_data raises the following exception: f"Trial {self.index} has already been completed with data. To add more data to it (for example, for a different metric), use Trial.update_trial_data() or BatchTrial.update_batch_trial_data()."

This is not right because there is no BatchTrial.update_batch_trial_data. Also, it's an anti-pattern for a superclass to reference its subclasses like this instead of delegating to them.

This PR:

  • Makes the behavior in the base class make sense for clases that have no method like "update trial data"
  • Overrides that error message for Trial which does have such an update method

Differential Revision: D55439108

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

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

esantorella added a commit to esantorella/Ax that referenced this pull request Mar 28, 2024
…ction (facebook#2304)

Summary:

`BaseTrial._validate_can_attach_data` raises the following exception: f"Trial {self.index} has already been completed with data. To add more data to it (for example, for a different metric), use `Trial.update_trial_data()` or BatchTrial.update_batch_trial_data()."

This is not right because there is no `BatchTrial.update_batch_trial_data`. Also, it's an anti-pattern for a superclass to reference its subclasses like this instead of delegating to them.

This PR:
- Makes the behavior in the base class make sense for clases that have no method like "update trial data"
- Overrides that error message for `Trial` which does have such an update method

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

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.91%. Comparing base (af1e662) to head (133ae41).

❗ Current head 133ae41 differs from pull request most recent head c8aa2d6. Consider uploading reports for the commit c8aa2d6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2304   +/-   ##
=======================================
  Coverage   94.90%   94.91%           
=======================================
  Files         489      489           
  Lines       47690    47710   +20     
=======================================
+ Hits        45262    45282   +20     
  Misses       2428     2428           

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

esantorella added a commit to esantorella/Ax that referenced this pull request Mar 28, 2024
…ction (facebook#2304)

Summary:

`BaseTrial._validate_can_attach_data` raises the following exception: f"Trial {self.index} has already been completed with data. To add more data to it (for example, for a different metric), use `Trial.update_trial_data()` or BatchTrial.update_batch_trial_data()."

This is not right because there is no `BatchTrial.update_batch_trial_data`. Also, it's an anti-pattern for a superclass to reference its subclasses like this instead of delegating to them.

This PR:
- Makes the behavior in the base class make sense for clases that have no method like "update trial data"
- Overrides that error message for `Trial` which does have such an update method

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

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

…ction (facebook#2304)

Summary:

`BaseTrial._validate_can_attach_data` raises the following exception: f"Trial {self.index} has already been completed with data. To add more data to it (for example, for a different metric), use `Trial.update_trial_data()` or BatchTrial.update_batch_trial_data()."

This is not right because there is no `BatchTrial.update_batch_trial_data`. Also, it's an anti-pattern for a superclass to reference its subclasses like this instead of delegating to them.

This PR:
- Makes the behavior in the base class make sense for clases that have no method like "update trial data"
- Overrides that error message for `Trial` which does have such an update method

Reviewed By: bernardbeckerman, mpolson64

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

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 86a4c8d.

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