Repository navigation
feat: support fractional CPU limits in operation resources #34
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,10 @@ def _int_from_config_value(value: object) -> int: | |
| return int(cast("Any", value)) | ||
|
|
||
|
|
||
| def _float_from_config_value(value: object) -> float: | ||
| return float(cast("Any", value)) | ||
|
Comment on lines
+42
to
+44
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. issue (bug_risk): Boolean config values are now silently accepted as cpu_limit, bypassing the bool check in With |
||
|
|
||
|
|
||
| def _get_config_value_with_default( | ||
| config: DictConfig, | ||
| key: str, | ||
|
|
@@ -161,7 +165,7 @@ def extract_operation_resources( | |
| logger, | ||
| ), | ||
| ) | ||
| cpu_limit = _int_from_config_value( | ||
| cpu_limit = _float_from_config_value( | ||
| _get_config_value_with_default(resources_config, "cpu_limit", 2, logger), | ||
| ) | ||
| gpu_limit = _int_from_config_value( | ||
|
|
||
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.
suggestion (testing): Consider adding a test for fractional cpu_limit inside the nested
resourcesblock as well.Since
extract_operation_resourcesalso readsresources.cpu_limit, please add a sibling test usingOmegaConf.create({"resources": {"cpu_limit": 0.5}})and asserting the extractedcpu_limitis0.5, to confirm nested configs follow the same semantics.