Skip to content

Commit 4aefe86

Browse files
FIX-#4518: Fix Modin Logging to report specific Modin warnings/errors (#4519)
Signed-off-by: Naren Krishna <[email protected]> Co-authored-by: Mahesh Vashishtha <[email protected]>
1 parent aabedd1 commit 4aefe86

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

docs/release_notes/release_notes-0.15.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Key Features and Updates
2222
* FIX-#4461: Fix S3 CSV data path (#4462)
2323
* FIX-#4467: `drop_duplicates` no longer removes items based on index values (#4468)
2424
* FIX-#4449: Drain the call queue before waiting on result in benchmark mode (#4472)
25+
* FIX-#4518: Fix Modin Logging to report specific Modin warnings/errors (#4519)
2526
* FIX-#4481: Allow clipping with a Modin Series of bounds (#4486)
2627
* FIX-#4504: Support na_action in applymap (#4505)
2728
* FIX-#4503: Stop the memory logging thread after session exit (#4515)

modin/error_message.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# governing permissions and limitations under the License.
1313

1414
import warnings
15-
from modin.logging import logger_decorator
15+
from modin.logging import get_logger
1616

1717

1818
class ErrorMessage(object):
@@ -21,10 +21,10 @@ class ErrorMessage(object):
2121
printed_warnings = set()
2222

2323
@classmethod
24-
@logger_decorator("MODIN-ERROR", "ErrorMessage.not_implemented", "debug")
2524
def not_implemented(cls, message=""):
2625
if message == "":
2726
message = "This functionality is not yet available in Modin."
27+
get_logger().info(f"Modin Error: NotImplementedError: {message}")
2828
raise NotImplementedError(
2929
f"{message}\n"
3030
+ "To request implementation, file an issue at "
@@ -33,17 +33,20 @@ def not_implemented(cls, message=""):
3333
)
3434

3535
@classmethod
36-
@logger_decorator("MODIN-ERROR", "ErrorMessage.single_warning", "debug")
3736
def single_warning(cls, message):
3837
message_hash = hash(message)
38+
logger = get_logger()
3939
if message_hash in cls.printed_warnings:
40+
logger.debug(
41+
f"Modin Warning: Single Warning: {message} was raised and suppressed."
42+
)
4043
return
4144

45+
logger.debug(f"Modin Warning: Single Warning: {message} was raised.")
4246
warnings.warn(message)
4347
cls.printed_warnings.add(message_hash)
4448

4549
@classmethod
46-
@logger_decorator("MODIN-ERROR", "ErrorMessage.default_to_pandas", "debug")
4750
def default_to_pandas(cls, message=""):
4851
if message != "":
4952
message = f"{message} defaulting to pandas implementation."
@@ -57,14 +60,13 @@ def default_to_pandas(cls, message=""):
5760
+ "https://modin.readthedocs.io/en/stable/supported_apis/defaulting_to_pandas.html for explanation."
5861
)
5962
cls.printed_default_to_pandas = True
63+
get_logger().debug(f"Modin Warning: Default to pandas: {message}")
6064
warnings.warn(message)
6165

6266
@classmethod
63-
@logger_decorator(
64-
"MODIN-ERROR", "ErrorMessage.catch_bugs_and_request_email", "debug"
65-
)
6667
def catch_bugs_and_request_email(cls, failure_condition, extra_log=""):
6768
if failure_condition:
69+
get_logger().info(f"Modin Error: Internal Error: {extra_log}")
6870
raise Exception(
6971
"Internal Error. "
7072
+ "Please visit https://github.com/modin-project/modin/issues "
@@ -74,23 +76,25 @@ def catch_bugs_and_request_email(cls, failure_condition, extra_log=""):
7476
)
7577

7678
@classmethod
77-
@logger_decorator("MODIN-ERROR", "ErrorMessage.non_verified_udf", "debug")
7879
def non_verified_udf(cls):
80+
get_logger().debug("Modin Warning: Non Verified UDF")
7981
warnings.warn(
8082
"User-defined function verification is still under development in Modin. "
8183
+ "The function provided is not verified."
8284
)
8385

8486
@classmethod
85-
@logger_decorator("MODIN-ERROR", "ErrorMessage.mismatch_with_pandas", "debug")
8687
def missmatch_with_pandas(cls, operation, message):
88+
get_logger().debug(
89+
f"Modin Warning: {operation} mismatch with pandas: {message}"
90+
)
8791
cls.single_warning(
8892
f"`{operation}` implementation has mismatches with pandas:\n{message}."
8993
)
9094

9195
@classmethod
92-
@logger_decorator("MODIN-ERROR", "ErrorMessage.not_initialized", "debug")
9396
def not_initialized(cls, engine, code):
97+
get_logger().debug(f"Modin Warning: Not Initialized: {engine}")
9498
warnings.warn(
9599
f"{engine} execution environment not yet initialized. Initializing...\n"
96100
+ "To remove this warning, run the following python code before doing dataframe operations:\n"

0 commit comments

Comments
 (0)