[data]: default Ray Data log encoding to UTF-8 on Windows#61143
Conversation
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a UnicodeEncodeError in Ray Data logging on Windows by defaulting the log file encoding to UTF-8. The change is cleanly implemented in SessionFileHandler, applying conditionally for the Windows OS. The PR also commendably refactors SessionFileHandler to allow dependency injection for the log directory path, which enhances testability. A new, well-structured unit test leverages this refactoring to validate the fix by simulating a Windows environment. The code is of high quality, and the changes are correct and well-tested.
bveeramani
left a comment
There was a problem hiding this comment.
Nice. Just one minor comment about the test
|
|
||
| logger = logging.getLogger("ray.data.test_windows_encoding") | ||
| logger.addHandler(handler) | ||
| try: |
There was a problem hiding this comment.
Could we create a tmp_logger pytest fixture? I think it'll make this test easier to read, and fixtures are more conventional for Python than try-catch
@pytest.fixture
def tmp_logger():
# 1. Unique name for total isolation
name = f"test_{uuid.uuid4().hex}"
logger = logging.getLogger(name)
yield logger
# 2. Close resources and clear references
for handler in logger.handlers[:]: # Slice copy to avoid mutation issues
handler.close()
logger.removeHandler(handler)
# 3. Reset level to prevent any weird propagation
logger.setLevel(logging.NOTSET)Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
…iding monkeypatch on os.name Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
|
@Sanskarzz looks like CI is failing. Would you mind taking a look? |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
…t#61143) ## Description Addressed review comment for [PR](ray-project#60177) ## Related issues ray-project#59967 --------- Signed-off-by: seekskyworld <djh1813553759@gmail.com> Signed-off-by: Sanskarzz <sanskar.gur@gmail.com> Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Co-authored-by: seekskyworld <djh1813553759@gmail.com> Co-authored-by: Balaji Veeramani <bveeramani@berkeley.edu>
…t#61143) ## Description Addressed review comment for [PR](ray-project#60177) ## Related issues ray-project#59967 --------- Signed-off-by: seekskyworld <djh1813553759@gmail.com> Signed-off-by: Sanskarzz <sanskar.gur@gmail.com> Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Co-authored-by: seekskyworld <djh1813553759@gmail.com> Co-authored-by: Balaji Veeramani <bveeramani@berkeley.edu>

Description
Addressed review comment for PR
Related issues
#59967