Summary
Metaflow currently only supports two effective CPU/memory configurations on Kubernetes, selected via the @kubernetes(qos=...) attribute:
Guaranteed — requests == limits (forced equal).
Burstable (default) — requests only, no limit (unbounded).
There is no way to specify a request that is lower than a limit — i.e. the standard Kubernetes pattern where a pod is guaranteed a baseline and may burst up to a bounded ceiling.
Motivation
A common use case is workloads that benefit from being able to burst above their requested resources when spare capacity is available, while still being capped so they can never consume unlimited resources on a node. Batch workloads are one general example of this. This is the canonical use case for requests < limits in Kubernetes.
The two currently-available options do not cover this:
Guaranteed prevents any bursting (request == limit).
Burstable allows bursting but with no ceiling, which is undesirable for shared/multi-tenant clusters and interacts poorly with namespace LimitRanges.
Prior discussion
This was raised in #1544 ("Support resource limits in Kubernetes"), which was closed by #2155 (the qos attribute). See also #2046. However, #2155 only implemented the Guaranteed/Burstable distinction. The specific need for independent request/limit values was explicitly noted in the #1544 thread but never addressed:
Requests are "I need at least X", limits are "I want this pod to use at most Y". These should not really be exclusive... often you want to specify both of these.
So the underlying request — bounded bursting via request < limit — remains unaddressed, and there is currently no open issue tracking it.
Proposal
Add a way to configure a limit that is higher than the request for CPU/memory. I do not want to prescribe a specific design; possible approaches include:
- Explicit limit attributes on the decorator (e.g.
cpu_limit / memory_limit) alongside the existing cpu / memory (treated as requests).
- A multiplier applied to requests to derive limits (e.g. a burst factor).
- Some other mechanism that composes cleanly with the existing
qos attribute and @resources.
Happy to discuss the design and/or contribute an implementation.
Relevant code
metaflow/plugins/kubernetes/kube_utils.py — qos_requests_and_limits() is the single source of truth; currently takes one scalar per resource.
- Call sites:
kubernetes_job.py, kubernetes_jobsets.py, argo/argo_workflows.py.
Summary
Metaflow currently only supports two effective CPU/memory configurations on Kubernetes, selected via the
@kubernetes(qos=...)attribute:Guaranteed—requests == limits(forced equal).Burstable(default) —requestsonly, no limit (unbounded).There is no way to specify a
requestthat is lower than alimit— i.e. the standard Kubernetes pattern where a pod is guaranteed a baseline and may burst up to a bounded ceiling.Motivation
A common use case is workloads that benefit from being able to burst above their requested resources when spare capacity is available, while still being capped so they can never consume unlimited resources on a node. Batch workloads are one general example of this. This is the canonical use case for
requests < limitsin Kubernetes.The two currently-available options do not cover this:
Guaranteedprevents any bursting (request == limit).Burstableallows bursting but with no ceiling, which is undesirable for shared/multi-tenant clusters and interacts poorly with namespaceLimitRanges.Prior discussion
This was raised in #1544 ("Support resource limits in Kubernetes"), which was closed by #2155 (the
qosattribute). See also #2046. However, #2155 only implemented theGuaranteed/Burstabledistinction. The specific need for independent request/limit values was explicitly noted in the #1544 thread but never addressed:So the underlying request — bounded bursting via
request < limit— remains unaddressed, and there is currently no open issue tracking it.Proposal
Add a way to configure a limit that is higher than the request for CPU/memory. I do not want to prescribe a specific design; possible approaches include:
cpu_limit/memory_limit) alongside the existingcpu/memory(treated as requests).qosattribute and@resources.Happy to discuss the design and/or contribute an implementation.
Relevant code
metaflow/plugins/kubernetes/kube_utils.py—qos_requests_and_limits()is the single source of truth; currently takes one scalar per resource.kubernetes_job.py,kubernetes_jobsets.py,argo/argo_workflows.py.