Skip to content
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

Provide method of defining greater than/less than constraints on numeric attributes #14719

Closed
tomqwpl opened this issue Sep 27, 2022 · 1 comment · Fixed by #14722
Closed
Assignees

Comments

@tomqwpl
Copy link

tomqwpl commented Sep 27, 2022

There appears to be no method of defining a >, >=. <, <= constraint on a numeric attribute such as memory.totalbytes or cpu.numcores.
I naively created such a constraint and it didn't work as expected. The documentation does say that the comparison is done lexicographically.

Could a means be provided to do a numeric comparison for attributes? Something like a custom driver attribute, or a user metadata attribute could reasonably be defined as numeric and you might want to do a numeric comparison on it.

@shoenig shoenig self-assigned this Sep 27, 2022
shoenig added a commit that referenced this issue Sep 27, 2022
This PR changes constraint comparisons to be numeric rather than
lexical if both operands are integers or floats.

Inspiration #4856
Closes #4729
Closes #14719
shoenig added a commit that referenced this issue Sep 27, 2022
* cleanup: fixup linter warnings in schedular/feasible.go

* core: numeric operands comparisons in constraints

This PR changes constraint comparisons to be numeric rather than
lexical if both operands are integers or floats.

Inspiration #4856
Closes #4729
Closes #14719

* fix: always parse as int64
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants