From 3bdbbcb3277a7c918bc037ca9b4106edb68ec815 Mon Sep 17 00:00:00 2001 From: Iaroslav Igoshev Date: Thu, 2 May 2024 17:47:51 +0200 Subject: [PATCH] FIX-#7234: Deprecate HDK engine (#7235) Signed-off-by: Igoshev, Iaroslav --- modin/config/envvars.py | 20 ++++++++++++++++++++ modin/error_message.py | 10 +++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/modin/config/envvars.py b/modin/config/envvars.py index d18a0a78924..d303d516b31 100644 --- a/modin/config/envvars.py +++ b/modin/config/envvars.py @@ -253,6 +253,26 @@ def _get_default(cls) -> str: "Please refer to installation documentation page to install an engine" ) + @classmethod + def get(cls) -> str: + """ + Get value of the Engine. + + Returns + ------- + str + """ + value = super().get() + if value == "Native": + from modin.error_message import ErrorMessage + + ErrorMessage.single_warning( + "HDK engine is deprecated and will be removed in a future version. " + + "Consider switching to Ray, Dask or MPI engine.", + FutureWarning, + ) + return value + @classmethod @doc(Parameter.add_option.__doc__) def add_option(cls, choice: Any) -> Any: diff --git a/modin/error_message.py b/modin/error_message.py index 54c646777af..a31cd5da3a6 100644 --- a/modin/error_message.py +++ b/modin/error_message.py @@ -12,7 +12,7 @@ # governing permissions and limitations under the License. import warnings -from typing import NoReturn, Set +from typing import NoReturn, Optional, Set from modin.logging import get_logger from modin.utils import get_current_execution @@ -36,7 +36,11 @@ def not_implemented(cls, message: str = "") -> NoReturn: ) @classmethod - def single_warning(cls, message: str) -> None: + def single_warning( + cls, message: str, category: Optional[type[Warning]] = None + ) -> None: + # note that there should not be identical messages with different categories since + # only the message is used as the hash key. message_hash = hash(message) logger = get_logger() if message_hash in cls.printed_warnings: @@ -46,7 +50,7 @@ def single_warning(cls, message: str) -> None: return logger.debug(f"Modin Warning: Single Warning: {message} was raised.") - warnings.warn(message) + warnings.warn(message, category=category) cls.printed_warnings.add(message_hash) @classmethod