fix lint formatting

This commit is contained in:
Korneliusz Jarzębski 2023-05-18 02:07:45 +02:00
parent f42d529b68
commit 56e928e5a5
2 changed files with 8 additions and 3 deletions

View File

@ -118,6 +118,7 @@ async def set_cpu_stats(all_stats: dict[str, Any]) -> None:
if cpu_stats:
all_stats["cpu_usages"] = cpu_stats
async def set_bandwidth_stats(all_stats: dict[str, Any]) -> None:
"""Set bandwidth from nethogs."""
bandwidth_stats = get_bandwidth_stats()
@ -125,6 +126,7 @@ async def set_bandwidth_stats(all_stats: dict[str, Any]) -> None:
if bandwidth_stats:
all_stats["bandwidth_usages"] = bandwidth_stats
async def set_gpu_stats(
config: FrigateConfig, all_stats: dict[str, Any], hwaccel_errors: list[str]
) -> None:

View File

@ -843,6 +843,7 @@ def get_cpu_stats() -> dict[str, dict]:
return usages
def get_bandwidth_stats() -> dict[str, dict]:
"""Get bandwidth usages for each ffmpeg process id"""
usages = {}
@ -861,14 +862,16 @@ def get_bandwidth_stats() -> dict[str, dict]:
for line in lines:
stats = list(filter(lambda a: a != "", line.strip().split("\t")))
try:
if re.search('^ffmpeg/([0-9]+)/', stats[0]):
if re.search("^ffmpeg/([0-9]+)/", stats[0]):
process = stats[0].split("/")
usages[process[1]] = {
"bandwidth": round(float(stats[2]), 1),
}
except:
continue
return usages
return usages
def get_amd_gpu_stats() -> dict[str, str]:
"""Get stats using radeontop."""