fix(resources): rename lambda var; convert asyncio.run test to async
This commit is contained in:
parent
d60503f059
commit
6b239b76e3
2 changed files with 5 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue