mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
fix unittest process crash
where the tests for tests?..
This commit is contained in:
parent
e33c87e9fe
commit
b56265e377
@ -925,9 +925,10 @@ def try_get_info(f, h, default="N/A"):
|
|||||||
|
|
||||||
|
|
||||||
def get_nvidia_gpu_stats() -> dict[int, dict]:
|
def get_nvidia_gpu_stats() -> dict[int, dict]:
|
||||||
|
results = {}
|
||||||
|
try:
|
||||||
nvml.nvmlInit()
|
nvml.nvmlInit()
|
||||||
deviceCount = nvml.nvmlDeviceGetCount()
|
deviceCount = nvml.nvmlDeviceGetCount()
|
||||||
results = {}
|
|
||||||
for i in range(deviceCount):
|
for i in range(deviceCount):
|
||||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||||
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
||||||
@ -947,7 +948,8 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
|||||||
"gpu": gpu_util,
|
"gpu": gpu_util,
|
||||||
"mem": gpu_mem_util,
|
"mem": gpu_mem_util,
|
||||||
}
|
}
|
||||||
|
except:
|
||||||
|
return results
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user