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

View File

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