New memory management#100
Conversation
4dabdcb to
eadcab3
Compare
| start_time = time.monotonic() | ||
| while True: | ||
| used_bytes, total_bytes = _get_ray_object_store_memory() | ||
| free_bytes = max(total_bytes - used_bytes, 0) |
There was a problem hiding this comment.
when will this be negative?
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
if total_bytes <= 0, there should be an errror raised in _get_ray_object_store_memory. Here we should assume its handled
There was a problem hiding this comment.
It may be a Ray error from their stat, do we want to raise here in this case, I would say not necessarily.
| usage_ok = projected_usage < threshold | ||
| space_ok = free_bytes >= required_bytes | ||
|
|
||
| if usage_ok and space_ok: |
There was a problem hiding this comment.
Think we only need usage_ok as it implies space_ok
| assert d._ray_start is ray_start | ||
|
|
||
|
|
||
| def test_default_ray_start_retries_until_ray_initializes(monkeypatch): |
There was a problem hiding this comment.
is this related to the memory management? Maybe this can be added (not sure) in a a separate PR on the new tests
| ----- | ||
| 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 |
No description provided.