-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[tune] Raise an error if Tuner.restore() is called on an instance
#39676
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -432,3 +432,12 @@ def get_results(self) -> ResultGrid: | |
| string_queue, | ||
| ) | ||
| return ray.get(get_results_future) | ||
|
|
||
| def __getattribute__(self, item): | ||
| if item == "restore": | ||
| raise AttributeError( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From https://docs.python.org/3/library/exceptions.html#AttributeError
And https://docs.python.org/3/reference/expressions.html#attribute-references
I think AttributeError is correct. |
||
| "`Tuner.restore()` is a classmethod and cannot be called on an " | ||
| "instance. Use `tuner = Tuner.restore(...)` to instantiate the " | ||
| "Tuner instead." | ||
| ) | ||
| return super().__getattribute__(item) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was a cleaner way to do this directly in the definition of
restore, but I'm not sure if there is one...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, at least I can't think of one right now. The
@classmethoddecorator passes the class in both cases...