[Bugfix][KV Offload] Check cgroup memory before SHM allocation (#54014)
Signed-off-by: Alex <jihui.huang@daocloud.io> Signed-off-by: AlexHuang <alex.tech.lab@outlook.com> Signed-off-by: Alex <alex.tech.lab@outlook.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Itay Etelis <92247226+Etelis@users.noreply.github.com>
This commit is contained in:
co-authored by
OpenAI Codex
Itay Etelis
parent
e0301afb2a
commit
0f8fa53acf
@@ -906,12 +906,13 @@ def test_insufficient_space_raises_clear_error(monkeypatch):
|
||||
monkeypatch.setattr(region.os, "open", mock_open)
|
||||
monkeypatch.setattr(region.os, "unlink", mock_unlink)
|
||||
monkeypatch.setattr(region.os, "close", mock_close)
|
||||
mock_check = MagicMock(
|
||||
side_effect=RuntimeError("Insufficient space in /dev/shm: 30 GB required.")
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
region,
|
||||
"check_shm_free_space",
|
||||
lambda *a, **kw: (_ for _ in ()).throw(
|
||||
RuntimeError("Insufficient space in /dev/shm: 30 GB required.")
|
||||
),
|
||||
mock_check,
|
||||
)
|
||||
|
||||
with pytest.raises(RuntimeError, match="Insufficient space"):
|
||||
@@ -925,6 +926,10 @@ def test_insufficient_space_raises_clear_error(monkeypatch):
|
||||
|
||||
mock_unlink.assert_called_once_with(mmap_path)
|
||||
mock_close.assert_called_once_with(9999)
|
||||
mock_check.assert_called_once_with(
|
||||
4 * PAGE_SIZE,
|
||||
allocation_name="CPU KV offload shared region in /dev/shm",
|
||||
)
|
||||
|
||||
|
||||
def test_ftruncate_failure_cleans_up_creator(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user