-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Correct memory units from MB to MiB #2309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,8 @@ def qos_requests_and_limits(qos: str, cpu: int, memory: int, storage: int): | |
| # Guaranteed - has both cpu/memory limits. requests not required, as these will be inferred. | ||
| qos_limits = { | ||
| "cpu": str(cpu), | ||
| "memory": "%sM" % str(memory), | ||
| "ephemeral-storage": "%sM" % str(storage), | ||
| "memory": "%sMi" % str(memory), | ||
| "ephemeral-storage": "%sMi" % str(storage), | ||
greptile-apps[bot] marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The PR description explicitly calls out the Consider adding a note to the PR description / release notes to cover this, e.g.:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated PR description accordingly |
||
| } | ||
| # NOTE: Even though Kubernetes will produce matching requests for the specified limits, this happens late in the lifecycle. | ||
| # 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 +53,8 @@ def qos_requests_and_limits(qos: str, cpu: int, memory: int, storage: int): | |
| # Burstable - not Guaranteed, and has a memory/cpu limit or request | ||
| qos_requests = { | ||
| "cpu": str(cpu), | ||
| "memory": "%sM" % str(memory), | ||
| "ephemeral-storage": "%sM" % str(storage), | ||
| "memory": "%sMi" % str(memory), | ||
| "ephemeral-storage": "%sMi" % str(storage), | ||
| } | ||
| # TODO: Add support for BestEffort once there is a use case for it. | ||
| # BestEffort - no limit or requests for cpu/memory | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,11 +61,11 @@ class KubernetesDecorator(StepDecorator): | |
| Number of CPUs required for this step. If `@resources` is | ||
| also present, the maximum value from all decorators is used. | ||
| memory : int, default 4096 | ||
| Memory size (in MB) required for this step. If | ||
| Memory size (in MiB) required for this step. If | ||
| `@resources` is also present, the maximum value from all decorators is | ||
| used. | ||
| disk : int, default 10240 | ||
| Disk size (in MB) required for this step. If | ||
| Disk size (in MiB) required for this step. If | ||
|
Comment on lines
+64
to
+68
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a peek at the units, and it seems that memory/disk values for kubernetes are treated as MB so the earlier docstring for these was correct. we could hold off on changing the kubernetes units in the docs for now, as this would require also changing the implementation to match.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alternatively changing the units from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for taking a look at the Kubernetes units. Since the defaults are multiples of 1024, MiB seems to be the original intent. So I think it makes sense to update the implementation, especially if doing so is as easy as you've described. Accordingly, I've pushed up a new commit: bfaa672. But, if you prefer, I could revert bfaa672 and 4fc5107 and update the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fwiw, the Kubernetes "Assign Memory Resources to Containers and Pods" example uses MiB, potentially indicating that MiB is more standard / expected there. Maybe. |
||
| `@resources` is also present, the maximum value from all decorators is | ||
| used. | ||
| image : str, optional, default None | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,9 +26,9 @@ class ResourcesDecorator(StepDecorator): | |
| gpu : int, optional, default None | ||
| Number of GPUs required for this step. | ||
| disk : int, optional, default None | ||
| Disk size (in MB) required for this step. Only applies on Kubernetes. | ||
| Disk size (in MiB) required for this step. Only applies on Kubernetes. | ||
| memory : int, default 4096 | ||
| Memory size (in MB) required for this step. | ||
| Memory size (in MiB) required for this step. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. given that these values are used in @kubernetes as well - would be good to ensure it's the case there too. also what about disk?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've not used Kubernetes before, so I wasn't sure about the three instances I left unchanged:
I am pretty sure this one (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| shared_memory : int, optional, default None | ||
| The value for the size (in MiB) of the /dev/shm volume for this step. | ||
| This parameter maps to the `--shm-size` option in Docker. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.