-
Notifications
You must be signed in to change notification settings - Fork 824
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?
Conversation
@@ -28,7 +28,7 @@ class ResourcesDecorator(StepDecorator): | |||
disk : int, optional, default None | |||
Disk size (in MB) 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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:
@kubernetes
memory
@kubernetes
disk
@resources
disk
(used only for Kubernetes)
I am pretty sure this one (@resources
memory
) should be MiB for AWS Batch. That may also be the case for Kubernetes, but I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @kubernetes
defaults, 4096 for memory
(4 × 1024) and 10240 (10 × 1024) for disk
, very strongly suggest that MiB was intended there as well, so I've updated the remaining three instances of "(in MB)" in 4fc5107.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively changing the units from M
to Mi
in kube_utils.py#qos_requests_and_limits
should be the only additional change required, as this is used both by the kubernetes and argo workflows implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively changing the units from
M
toMi
inkube_utils.py#qos_requests_and_limits
should be the only additional change required, as this is used both by the kubernetes and argo workflows implementations.
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 @resources
docstring to indicate that the memory units are MiB for AWS Batch and MB for Kubernetes. Just let me know your preference. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
As a heads up I'll be looking into some other inconsistencies of For now this PR seems good to go as is so no further action required 👌 |
OK, great. Thanks for the update! |
The docs currently suggest that the
@batch
and@resources
memory units are MB, but I suspect they may be MiB.For AWS Batch computes, I believe these parameters are passed directly to
ResourceRequirement
, like so:and the
ResourceRequirement
docs indicate memory values are in MiB.Furthermore, the default of 4096 makes sense to me if the units are MiB, since 4096 MiB = 4 GiB. If MB, it's hard to interpret.
This PR originally proposed changes to four of seven instances of "(in MB)". Upon further reflection, it now includes the remaining three, Kubernetes-specific, instances.