Repository navigation
[Data] Add memory hint for reads to image_embedding_from_jsonl - #64717
Conversation
Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Balaji Veeramani <[email protected]>
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) 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]>
) (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]>
…-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]>
Reads can use lots of memory in the
image_embedding_from_jsonlrelease test. To prevent expected OOMs, I'm adding a memory hint for the read based on the historical heap usage.