Skip to content

Commit bfaa672

Browse files
committed
Update Kubernetes units from MB to MiB
1 parent 4fc5107 commit bfaa672

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

metaflow/plugins/kubernetes/kube_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import re
22
from typing import Dict, List, Optional
3+
34
from metaflow.exception import CommandException, MetaflowException
4-
from metaflow.util import get_username, get_latest_run_id
5+
from metaflow.util import get_latest_run_id, get_username
56

67

78
# avoid circular import by having the exception class contained here
@@ -43,8 +44,8 @@ def qos_requests_and_limits(qos: str, cpu: int, memory: int, storage: int):
4344
# Guaranteed - has both cpu/memory limits. requests not required, as these will be inferred.
4445
qos_limits = {
4546
"cpu": str(cpu),
46-
"memory": "%sM" % str(memory),
47-
"ephemeral-storage": "%sM" % str(storage),
47+
"memory": "%sMi" % str(memory),
48+
"ephemeral-storage": "%sMi" % str(storage),
4849
}
4950
# NOTE: Even though Kubernetes will produce matching requests for the specified limits, this happens late in the lifecycle.
5051
# We specify them explicitly here to make some K8S tooling happy, in case they rely on .resources.requests being present at time of submitting the job.
@@ -53,8 +54,8 @@ def qos_requests_and_limits(qos: str, cpu: int, memory: int, storage: int):
5354
# Burstable - not Guaranteed, and has a memory/cpu limit or request
5455
qos_requests = {
5556
"cpu": str(cpu),
56-
"memory": "%sM" % str(memory),
57-
"ephemeral-storage": "%sM" % str(storage),
57+
"memory": "%sMi" % str(memory),
58+
"ephemeral-storage": "%sMi" % str(storage),
5859
}
5960
# TODO: Add support for BestEffort once there is a use case for it.
6061
# BestEffort - no limit or requests for cpu/memory

0 commit comments

Comments
 (0)