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

[tune] Structure refactor: Raise on import of old modules #32486

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions python/ray/tune/_structure_refactor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

from ray.util import log_once


Expand All @@ -8,7 +6,7 @@ def warn_structure_refactor(old_module: str, new_module: str, direct: bool = Tru
if log_once(f"tune:structure:refactor:{old_module}"):
warning = (
f"The module `{old_module}` has been moved to `{new_module}` and the old "
f"location will be deprecated soon. Please adjust your imports to point "
f"location has been deprecated. Please adjust your imports to point "
f"to the new location."
)

Expand All @@ -24,6 +22,4 @@ def warn_structure_refactor(old_module: str, new_module: str, direct: bool = Tru
f"check the contents of `{new_module}` before making changes."
)

with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(warning, DeprecationWarning, stacklevel=3)
raise DeprecationWarning(warning)