Closed zonnie closed 5 years ago
@zonnie Spreads can be specified at the job/task group or task level. In your json file, you have specified it at the task group level. I ran your example and checked the output of nomad inspect
and I do see the Spreads
attribute at the task group worker1
.
Can you run nomad alloc status -verbose <allocid>
on one of the allocations for this job and paste the output of the "Placement Metadata" section? That should show whether spread criteria was used in scoring placements.
@preetapan Here you go:
ID = 596d14cc-6b1b-0748-b4e9-db06e6b7e50a
Eval ID = 275ba214-83f3-c487-d22f-65d70f9a273e
Name = worker1[1]
Node ID = 3a58975d-39e5-42c8-f893-06ba1ab1a917
Job ID = worker1
Job Version = 0
Client Status = running
Client Description = <none>
Desired Status = run
Desired Description = <none>
Created = 2019-04-18T11:54:38Z
Modified = 2019-04-18T11:54:50Z
Evaluated Nodes = 1
Filtered Nodes = 0
Exhausted Nodes = 0
Allocation Time = 177.06µs
Failures = 0
Task "worker1" is "running"
Task Resources
CPU Memory Disk Addresses
49/20 MHz 76 MiB/2.0 GiB 300 MiB
Task Events:
Started At = 2019-04-18T11:54:39Z
Finished At = N/A
Total Restarts = 0
Last Restart = N/A
Recent Events:
Time Type Description
2019-04-18T11:54:39Z Started Task started by client
2019-04-18T11:54:39Z Task Setup Building Task Directory
2019-04-18T11:54:39Z Received Task received by client
Placement Metrics
* Score "3a58975d-39e5-42c8-f893-06ba1ab1a917.binpack" = 2.074423
* Score "3a58975d-39e5-42c8-f893-06ba1ab1a917.job-anti-affinity" = -20.000000
Also double checked and my Spread
is null
on both job
and task group
levels.
@zonnie That looks like you are running a 0.8.7 CLI against a 0.9 server? When I ran your example I used 0.9 everywhere. The placement metrics in the CLI output should look like this example, with a column for spread score.
@preetapan Is there a way to check the version of the client itself ?
Even though that is very weird because I use the same binary and running nomad version
gets this:
Nomad v0.9.0 (18dd59056ee1d7b2df51256fe900a98460d3d6b9)
Can you run curl on http;//127.0.0.1:4646/v1/agent/self"
and report the Version
section. It should look something like:
"Version": {
"Revision": "",
"Version": "0.9.0",
"VersionMetadata": "",
"VersionPrerelease": ""
}
Also check what nomad server members
returns to confirm that your nomad server is also on 0.9.
I tried your example again on the official binaries downloaded from releases.hashicorp.com and I still see the Spreads
attribute defined at the taskgroup level
@preetapan - You are correct, not sure how...but that's on me:
"Version": {
"Revision": "21a2d93eecf018ad2209a5eab6aae6c359267933+CHANGES",
"Version": "0.8.7",
"VersionMetadata": "",
"VersionPrerelease": ""
}
Thanks a lot ! PS - Nomad is awesome (coming from someone who spent a painful vacation in Mesos/Marathon land)
You are welcome and thanks for using Nomad!
Another thing I wanted to point out that I noticed, you have a constraint on meta.slave=true
, which means only nodes that have that set to true are eligible for placement. You also have a spread
stanza on the same attribute. The spread
stanza does useful things only when you have more than one unique value for the attribute (e.g datacenter or rack). In your case, because you already have a constraint that limits the set of nodes, the distinct_hosts
constraint is likely what you need rather than spread.
See https://www.nomadproject.io/docs/job-specification/constraint.html#quot-distinct_hosts-quot- for more info.
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.
Nomad version
Nomad v0.9.0 (18dd59056ee1d7b2df51256fe900a98460d3d6b9)
Operating system and Environment details
Linux prod_1 3.16.0-77-generic #99~14.04.1-Ubuntu SMP Tue Jun 28 19:17:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Issue
Unable to use the new
spread
stanza. I tried adding it in all levels (job
,group
andtask
) and it seems to have no effect. To verify I use thenomad inspect
command and getSpreads: null
in return 😢 Am I missing something ?Reproduction steps
a.txt
curl -XPOST http://localhost:4646/v1/jobs -H "Content-Type: application/json" -d @a.txt
gc-nomad job inspect worker1 | grep Spread -C 2
and get:I.e. seems like the
spread
is not effecting the jobJob file
Nomad Client logs
Nomad Server logs