mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
fix lint formatting
This commit is contained in:
parent
f42d529b68
commit
56e928e5a5
@ -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:
|
||||||
|
|||||||
@ -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 = {}
|
||||||
@ -860,15 +861,17 @@ def get_bandwidth_stats() -> dict[str, dict]:
|
|||||||
lines = p.stdout.split("\n")
|
lines = p.stdout.split("\n")
|
||||||
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."""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user