Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 1, 2023
1 parent fae42de commit d3685ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/core/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions app/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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


Expand Down
4 changes: 3 additions & 1 deletion app/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List

from pydantic import BaseModel


Expand Down Expand Up @@ -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]
gpus: list[SingleGPUStats]

0 comments on commit d3685ec

Please sign in to comment.