From 447df28746a410ff9bae95743faa50593d1f1a26 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sat, 24 Sep 2022 19:33:35 -0600 Subject: [PATCH] Formatting --- frigate/util.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/frigate/util.py b/frigate/util.py index 1001440e0..7d769d206 100755 --- a/frigate/util.py +++ b/frigate/util.py @@ -783,13 +783,7 @@ def ffprobe_stream(path: str) -> sp.CompletedProcess: def get_amd_gpu_stats() -> dict[str, str]: """Get stats using radeontop.""" - radeontop_command = [ - "radeontop", - "-d", - "-", - "-l", - "1" - ] + radeontop_command = ["radeontop", "-d", "-", "-l", "1"] p = sp.run( radeontop_command, @@ -812,18 +806,10 @@ def get_amd_gpu_stats() -> dict[str, str]: return results + def get_intel_gpu_stats() -> dict[str, str]: """Get stats using intel_gpu_top.""" - radeontop_command = [ - "timeout", - "1s", - "intel_gpu_top", - "-J", - "-o", - "-", - "-s", - "1" - ] + radeontop_command = ["timeout", "1s", "intel_gpu_top", "-J", "-o", "-", "-s", "1"] p = sp.run( radeontop_command, @@ -852,7 +838,7 @@ def get_nvidia_gpu_stats() -> dict[str, str]: nvidia_smi_command = [ "nvidia-smi", "--query-gpu=gpu_name,utilization.gpu,memory.used,memory.total", - "--format=csv" + "--format=csv", ] p = sp.run( @@ -866,11 +852,11 @@ def get_nvidia_gpu_stats() -> dict[str, str]: return None else: usages = p.stdout.split("\n")[1].strip() - memory_percent = f"{round(float(usages[2].replace(' MiB', '')) / float(usages[3].replace(' MiB', '')) * 100, 1)}" %" + memory_percent = f"{round(float(usages[2].replace(' MiB', '')) / float(usages[3].replace(' MiB', '')) * 100, 1)} %" results: dict[str, str] = { "name": usages[0], "gpu_usage": usages[1], - "memory_usage": memory_percent + "memory_usage": memory_percent, } return results