Skip to content

Commit cf89619

Browse files
authored
fix: use correct CPU quantity (#1239)
1 parent 20e13ad commit cf89619

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

components/renku_data_services/crc/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from collections.abc import Callable
66
from dataclasses import asdict, dataclass, field
77
from enum import StrEnum
8+
from math import ceil
89
from typing import Any, Optional, Protocol, Self
910

1011
from kubernetes.utils import parse_quantity
@@ -187,7 +188,7 @@ def require_key(manifest: dict, key: str, prefix: str = "") -> Any:
187188
memory_raw = require_key(hard, "requests.memory", "hard.")
188189
cpu_raw = require_key(hard, "requests.cpu", "hard.")
189190
return cls(
190-
cpu=float(parse_quantity(cpu_raw)) / 1_000_000_000,
191+
cpu=float(parse_quantity(cpu_raw)),
191192
memory=round(parse_quantity(memory_raw) / 1_000_000_000),
192193
gpu=gpu,
193194
gpu_kind=gpu_kind,
@@ -204,7 +205,7 @@ def to_patch(self, labels: dict[str, str]) -> K8sPatch:
204205
},
205206
"spec": {
206207
"hard": {
207-
"requests.cpu": str(round(self.cpu * 1_000_000_000)),
208+
"requests.cpu": str(ceil(self.cpu)),
208209
"requests.memory": str(self.memory * 1_000_000_000),
209210
f"requests.{self.gpu_kind}/gpu": self.gpu,
210211
},

0 commit comments

Comments
 (0)