From 51a407f2bc8659d08d601560af10535057d30e94 Mon Sep 17 00:00:00 2001 From: Thomas Bartelmess Date: Tue, 28 Nov 2017 23:15:32 -0500 Subject: [PATCH] Changed Superset to only return the resource name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Superset method on Resources used to return a string in the format of “[resource name] exhausted”. This was leading to the output in plan/create job API DimensionExhausted to return keys like ``` "DimensionExhausted": {"cpu exhausted": 1} ``` This was not anywhere documented, however, one of the examples on the website showed it like this. The other side effect of this is that the CLI formats the strings from the name of the key leading to output like ``` * Dimension "cpu exhausted" exhausted on 1 nodes ``` --- nomad/structs/structs.go | 8 ++++---- website/source/api/jobs.html.md | 2 +- website/source/docs/commands/job/status.html.md.erb | 2 +- website/source/docs/commands/plan.html.md.erb | 2 +- .../source/docs/operating-a-job/inspecting-state.html.md | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index cbd2dd9bb..ab0ab548d 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1339,16 +1339,16 @@ func (r *Resources) NetIndex(n *NetworkResource) int { // should be used for that. func (r *Resources) Superset(other *Resources) (bool, string) { if r.CPU < other.CPU { - return false, "cpu exhausted" + return false, "cpu" } if r.MemoryMB < other.MemoryMB { - return false, "memory exhausted" + return false, "memory" } if r.DiskMB < other.DiskMB { - return false, "disk exhausted" + return false, "disk" } if r.IOPS < other.IOPS { - return false, "iops exhausted" + return false, "iops" } return true, "" } diff --git a/website/source/api/jobs.html.md b/website/source/api/jobs.html.md index eb932f954..a923939cf 100644 --- a/website/source/api/jobs.html.md +++ b/website/source/api/jobs.html.md @@ -1477,7 +1477,7 @@ $ curl \ "NodesExhausted": 1, "ClassExhausted": null, "DimensionExhausted": { - "cpu exhausted": 1 + "cpu": 1 } } }, diff --git a/website/source/docs/commands/job/status.html.md.erb b/website/source/docs/commands/job/status.html.md.erb index 5ff67823c..e397f0d26 100644 --- a/website/source/docs/commands/job/status.html.md.erb +++ b/website/source/docs/commands/job/status.html.md.erb @@ -177,7 +177,7 @@ cache 1 0 4 0 0 0 Placement Failure Task Group "cache": * Resources exhausted on 1 nodes - * Dimension "cpu exhausted" exhausted on 1 nodes + * Dimension "cpu" exhausted on 1 nodes Latest Deployment ID = bb4b2fb1 diff --git a/website/source/docs/commands/plan.html.md.erb b/website/source/docs/commands/plan.html.md.erb index 686aa57c8..8fbb04f35 100644 --- a/website/source/docs/commands/plan.html.md.erb +++ b/website/source/docs/commands/plan.html.md.erb @@ -103,7 +103,7 @@ Scheduler dry-run: - WARNING: Failed to place all allocations. Task Group "cache" (failed to place 3 allocations): * Resources exhausted on 1 nodes - * Dimension "cpu exhausted" exhausted on 1 nodes + * Dimension "cpu" exhausted on 1 nodes Job Modify Index: 15 To submit the job with version verification run: diff --git a/website/source/docs/operating-a-job/inspecting-state.html.md b/website/source/docs/operating-a-job/inspecting-state.html.md index 10908b545..d4af23d19 100644 --- a/website/source/docs/operating-a-job/inspecting-state.html.md +++ b/website/source/docs/operating-a-job/inspecting-state.html.md @@ -98,7 +98,7 @@ ID Priority Triggered By Status Placement Failures Placement Failure Task Group "example": * Resources exhausted on 1 nodes - * Dimension "cpu exhausted" exhausted on 1 nodes + * Dimension "cpu" exhausted on 1 nodes Allocations ID Eval ID Node ID Task Group Desired Status Created At @@ -135,7 +135,7 @@ Placement Failures = true Failed Placements Task Group "example" (failed to place 3 allocations): * Resources exhausted on 1 nodes - * Dimension "cpu exhausted" exhausted on 1 nodes + * Dimension "cpu" exhausted on 1 nodes Evaluation "5744eb15" waiting for additional capacity to place remainder ```