From d3685ec721c2c1191da64c9f73b55912033d358e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:33:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- app/core/services.py | 2 +- app/core/utils.py | 9 ++++++--- app/schemas.py | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/core/services.py b/app/core/services.py index ab14ffa..1108a8e 100644 --- a/app/core/services.py +++ b/app/core/services.py @@ -288,7 +288,7 @@ def get_gpu_stats_all(): "free_memory": all_stats["free_memory"], "average_utilised_memory": all_stats["average_utilised_memory"], "average_load": all_stats["average_load"], - "gpus": all_gpus + "gpus": all_gpus, } return stats diff --git a/app/core/utils.py b/app/core/utils.py index 96d1ae0..bddf213 100644 --- a/app/core/utils.py +++ b/app/core/utils.py @@ -224,7 +224,7 @@ def get_gpu_infos(): "used_memory": round(gpu.memoryUsed / 1024, 2), "free_memory": round(gpu.memoryFree / 1024, 2), "utilised_memory": round(gpu.memoryUsed / gpu.memoryTotal, 2), - "load": round(gpu.load, 2) + "load": round(gpu.load, 2), } gpu_infos.append(info) @@ -239,12 +239,15 @@ def total_gpu_stats(): "total_memory": sum(info["total_memory"] for info in infos), "used_memory": sum(info["used_memory"] for info in infos), "free_memory": sum(info["free_memory"] for info in infos), - "average_utilised_memory": round(sum(info["utilised_memory"] for info in infos) / len(infos), 2), - "average_load": round(sum(info["load"] for info in infos) / len(infos), 2) + "average_utilised_memory": round( + sum(info["utilised_memory"] for info in infos) / len(infos), 2 + ), + "average_load": round(sum(info["load"] for info in infos) / len(infos), 2), } return total_stats + cached_domain = None diff --git a/app/schemas.py b/app/schemas.py index f00584a..ea34682 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -1,4 +1,5 @@ from typing import List + from pydantic import BaseModel @@ -110,10 +111,11 @@ class SingleGPUStats(BaseModel): utilised_memory: float = None load: float = None + class GPUStatsResponse(BaseModel): total_memory: float = None used_memory: float = None free_memory: float = None average_utilised_memory: float = None average_load: float = None - gpus: List[SingleGPUStats] \ No newline at end of file + gpus: list[SingleGPUStats]