feat(resources): cf-orch GPU VRAM orchestration — Plan A core #1

Merged
pyr0ball merged 21 commits from feature/cforch-core-orchestration into main 2026-03-31 10:43:53 -07:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 6b239b76e3 - Show all commits

View file

@ -65,7 +65,7 @@ class LeaseManager:
and lease.gpu_id == gpu_id
and lease.priority > requester_priority
]
candidates.sort(key=lambda l: l.priority, reverse=True)
candidates.sort(key=lambda lease: lease.priority, reverse=True)
selected: list[VRAMLease] = []
freed = 0
for candidate in candidates:

View file

@ -1,4 +1,3 @@
import asyncio
import pytest
from circuitforge_core.resources.coordinator.lease_manager import LeaseManager
@ -77,9 +76,10 @@ def test_register_gpu_sets_total(mgr):
assert mgr.gpu_total_mb("heimdall", 0) == 8192
def test_used_mb_tracks_grants():
@pytest.mark.asyncio
async def test_used_mb_tracks_grants():
mgr = LeaseManager()
mgr.register_gpu("heimdall", 0, 8192)
asyncio.run(mgr.try_grant("heimdall", 0, 3000, "a", 1))
asyncio.run(mgr.try_grant("heimdall", 0, 2000, "b", 2))
await mgr.try_grant("heimdall", 0, 3000, "a", 1)
await mgr.try_grant("heimdall", 0, 2000, "b", 2)
assert mgr.used_mb("heimdall", 0) == 5000