Skip to content

New memory management#100

Open
StrappazzonHugo wants to merge 6 commits into
mainfrom
new-memory-management
Open

New memory management#100
StrappazzonHugo wants to merge 6 commits into
mainfrom
new-memory-management

Conversation

@StrappazzonHugo

Copy link
Copy Markdown
Collaborator

No description provided.

@StrappazzonHugo StrappazzonHugo force-pushed the new-memory-management branch from 4dabdcb to eadcab3 Compare June 22, 2026 13:45
Comment thread src/deisa/ray/bridge.py
start_time = time.monotonic()
while True:
used_bytes, total_bytes = _get_ray_object_store_memory()
free_bytes = max(total_bytes - used_bytes, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

when will this be negative?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I asked why Codex did it and this is what it said :
Theoretically shouldn't happen, but can occur due to:

transient measurement inconsistencies,
sampling races,
rounding/conversion errors,
Ray reporting slightly stale statistics.

Comment thread src/deisa/ray/bridge.py
used_bytes, total_bytes = _get_ray_object_store_memory()
free_bytes = max(total_bytes - used_bytes, 0)
projected_used_bytes = used_bytes + required_bytes
projected_usage = projected_used_bytes / total_bytes if total_bytes > 0 else 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if total_bytes <= 0, there should be an errror raised in _get_ray_object_store_memory. Here we should assume its handled

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It may be a Ray error from their stat, do we want to raise here in this case, I would say not necessarily.

Comment thread src/deisa/ray/bridge.py Outdated
usage_ok = projected_usage < threshold
space_ok = free_bytes >= required_bytes

if usage_ok and space_ok:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think we only need usage_ok as it implies space_ok

Comment thread tests/test_config.py Outdated
assert d._ray_start is ray_start


def test_default_ray_start_retries_until_ray_initializes(monkeypatch):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this related to the memory management? Maybe this can be added (not sure) in a a separate PR on the new tests

Comment thread src/deisa/ray/window_handler.py Outdated
-----
Initializes Ray only once with minimal logging. Used when the caller
does not provide a custom ``ray_start`` hook.
Initializes Ray only once with minimal logging. If the Ray runtime is not

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Separate PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants