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

[scheduler] Honor false for distinct hosts constraint #16907

Merged
merged 4 commits into from
Apr 17, 2023
Merged

Conversation

angrycub
Copy link
Contributor

@angrycub angrycub commented Apr 17, 2023

Currently, when checking a nodes feasibility against the distinct_hosts constraint, the mere presence of the constraint is sufficient to activate it; however, the documentation indicates that setting the value to false is a legitimate answer.

The jobspec HCL1 parser would look for cases where the value was set to false and strip it from the generated job specification before submission. The jobspec2 HCL2 parser writes it into the specification with the provided value whether true or false.

This has the consequence of causing jobs or tasks with a distinct_hosts constraint to always act as though the value is set to true.

Fixes #13861

  • Honor value for distinct_hosts constraint
  • Add test for feasibility checking for false

Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

scheduler/feasible.go Outdated Show resolved Hide resolved
@angrycub angrycub marked this pull request as ready for review April 17, 2023 21:33
Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like @schmichael beat me to the punch on reviewing this, but just wanted to say LGTM and the PR description here was top notch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line backport/1.5.x backport to 1.5.x release line theme/scheduling type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make distinct_hosts as a variable not working
3 participants