Nomad: Constraint numeric comparison

Created on 27 Sep 2018  路  7Comments  路  Source: hashicorp/nomad

For some reason job with

~~
constraint {
attribute = "${attr.cpu.numcores}"
operator = ">"
value = "10"
}
~
~

Is placed to machines with cpu.numcores == 8.

Why? Even if constraints are not mandatory but merely advisory a job should have been placed to client with 10+ cores, right?

themscheduling typbug

Most helpful comment

Thanks, but according to your comment it looks like a bug...

All 7 comments

I changed the title of the issue. Constraints are compared lexicographically. We should parse it as a number if possible however. Marking as an enhancement

Thanks, but according to your comment it looks like a bug...

Is there any hope to get it fixed?

It looks like @MrJacek has a patch here https://github.com/MrJacek/nomad/commit/74e43fe8d64c8261e7e0344181cf8aa2554af24d that was never submitted as a PR. I wonder if we could get him to submit that?

It was submitted as a PR in 4856 but rejected :)

Ah, I see that now. It does look like this should be supported following https://github.com/hashicorp/nomad/pull/4783 where attributes get parsed into numbers, but I just verified it's still lexicographically sorting the constraints. I'll dig into this because the behavior seems like a gotcha even if it's documented.

Thanks, @tgross. I agree that documenting this bug is not enough. It should be fixed as current behaviour is illogical, counter-intuitive and potent to cause very undesirable placement issues.

It does not seem to be a difficult technical issue to fix, right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dvusboy picture dvusboy  路  3Comments

funkytaco picture funkytaco  路  3Comments

hynek picture hynek  路  3Comments

ashald picture ashald  路  3Comments

bdclark picture bdclark  路  3Comments