Skip to content

[data]: default Ray Data log encoding to UTF-8 on Windows#61143

Merged
bveeramani merged 16 commits into
ray-project:masterfrom
Sanskarzz:seekskyworld/fix/59967-data-log-utf8
Mar 19, 2026
Merged

[data]: default Ray Data log encoding to UTF-8 on Windows#61143
bveeramani merged 16 commits into
ray-project:masterfrom
Sanskarzz:seekskyworld/fix/59967-data-log-utf8

Conversation

@Sanskarzz

Copy link
Copy Markdown
Contributor

Description

Addressed review comment for PR

Related issues

#59967

seekskyworld and others added 3 commits January 16, 2026 01:40
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@Sanskarzz Sanskarzz requested a review from a team as a code owner February 18, 2026 19:33

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bveeramani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Just one minor comment about the test

Comment thread python/ray/data/tests/test_logging.py Outdated

logger = logging.getLogger("ray.data.test_windows_encoding")
logger.addHandler(handler)
try:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
@ray-gardener ray-gardener Bot added the community-contribution Contributed by the community label Feb 19, 2026
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Comment thread python/ray/data/tests/test_logging.py
Comment thread python/ray/data/tests/test_logging.py
Comment thread python/ray/data/tests/test_logging.py
Comment thread python/ray/data/_internal/logging.py
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Comment thread python/ray/data/tests/test_logging.py
@bveeramani

Copy link
Copy Markdown
Member

@Sanskarzz looks like CI is failing. Would you mind taking a look?

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Mar 18, 2026
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Comment thread python/ray/data/tests/test_logging.py
@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Mar 19, 2026
Comment thread python/ray/data/tests/test_logging.py Outdated
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
@bveeramani bveeramani enabled auto-merge (squash) March 19, 2026 03:58
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Mar 19, 2026
@bveeramani bveeramani disabled auto-merge March 19, 2026 03:59
@bveeramani bveeramani enabled auto-merge (squash) March 19, 2026 03:59
@bveeramani bveeramani merged commit 5709cad into ray-project:master Mar 19, 2026
8 of 9 checks passed
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Mar 25, 2026
…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>
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

3 participants