Skip to content

[Data] Add memory hint for reads to image_embedding_from_jsonl - #64717

Merged
bveeramani merged 3 commits into
masterfrom
from-jsonl-memory
Jul 13, 2026
Merged

bveeramani merged 3 commits into
masterfrom
from-jsonl-memory

Conversation

@bveeramani

Copy link
Copy Markdown
Member

Reads can use lots of memory in the image_embedding_from_jsonl release test. To prevent expected OOMs, I'm adding a memory hint for the read based on the historical heap usage.

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Balaji Veeramani <[email protected]>

@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 configures memory settings in the image_embedding_from_jsonl nightly test to prevent out-of-memory (OOM) errors. Specifically, it sets default_map_logical_memory_enabled to True on the Ray DataContext and specifies a memory limit of 3 GiB when reading JSON data. The reviewer suggests restoring the original value of default_map_logical_memory_enabled after the benchmark function runs to avoid unintended side effects on other parts of the code.

# `default_map_logical_memory_enabled` is a best practice that's required for
# Ray Data to prevent OOMs. It's not enabled by default in Ray 2.56, but we
# intend to enable it by default in a future release.
ray.data.DataContext.get_current().default_map_logical_memory_enabled = True

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.

medium

Modifying the global DataContext can have unintended side effects on other parts of the code that run after this function. It's a good practice to restore the original value after the function completes to ensure the change is scoped locally. You can achieve this using a try...finally block.

For example:

def benchmark_fn():
    ctx = ray.data.DataContext.get_current()
    original_value = ctx.default_map_logical_memory_enabled
    try:
        ctx.default_map_logical_memory_enabled = True
        # ... benchmark logic ...
    finally:
        ctx.default_map_logical_memory_enabled = original_value

@ray-gardener ray-gardener Bot added data Ray Data-related issues release-test release test labels Jul 13, 2026

@rayhhome rayhhome 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.

LGTM!

@bveeramani
bveeramani enabled auto-merge (squash) July 13, 2026 22:37
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Jul 13, 2026
@bveeramani
bveeramani merged commit 8ceac10 into master Jul 13, 2026
4 checks passed
@bveeramani
bveeramani deleted the from-jsonl-memory branch July 13, 2026 23:01
elliot-barn added a commit that referenced this pull request Jul 14, 2026
)

Reads can use lots of memory in the `image_embedding_from_jsonl` release
test. To prevent expected OOMs, I'm adding a memory hint for the read
based on the historical heap usage.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: Elliot Barnwell <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
elliot-barn added a commit that referenced this pull request Jul 15, 2026
) (cherry-pick 2.56.1) (#64757)

Cherry-pick of #64717 onto `releases/2.56.1`.

Original PR: #64717

## Summary
Reads can use lots of memory in the `image_embedding_from_jsonl` release
test. To prevent expected OOMs, this adds a memory hint for the read.

Clean cherry-pick, no conflicts.

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Balaji Veeramani <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…-project#64717)

Reads can use lots of memory in the `image_embedding_from_jsonl` release
test. To prevent expected OOMs, I'm adding a memory hint for the read
based on the historical heap usage.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: Elliot Barnwell <[email protected]>
Signed-off-by: 400Ping <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants