@@ -36,13 +36,15 @@ Eval Status Options:
36
36
Monitor an outstanding evaluation
37
37
38
38
-verbose
39
- Show full information .
39
+ Show full-length IDs and exact timestamps .
40
40
41
41
-json
42
- Output the evaluation in its JSON format.
42
+ Output the evaluation in its JSON format. This format will not include
43
+ placed allocations.
43
44
44
45
-t
45
- Format and display evaluation using a Go template.
46
+ Format and display evaluation using a Go template. This format will not
47
+ include placed allocations.
46
48
47
49
-ui
48
50
Open the evaluation in the browser.
@@ -73,10 +75,6 @@ func (c *EvalStatusCommand) AutocompleteArgs() complete.Predictor {
73
75
return nil
74
76
}
75
77
76
- if err != nil {
77
- return nil
78
- }
79
-
80
78
resp , _ , err := client .Search ().PrefixSearch (a .Last , contexts .Evals , nil )
81
79
if err != nil {
82
80
return []string {}
@@ -120,12 +118,6 @@ func (c *EvalStatusCommand) Run(args []string) int {
120
118
121
119
evalID := args [0 ]
122
120
123
- // Truncate the id unless full length is requested
124
- length := shortId
125
- if verbose {
126
- length = fullId
127
- }
128
-
129
121
// Query the allocation info
130
122
if len (evalID ) == 1 {
131
123
c .Ui .Error ("Identifier must contain at least two characters." )
@@ -153,6 +145,12 @@ func (c *EvalStatusCommand) Run(args []string) int {
153
145
return 1
154
146
}
155
147
148
+ // Truncate the id unless full length is requested
149
+ length := shortId
150
+ if verbose {
151
+ length = fullId
152
+ }
153
+
156
154
// If we are in monitor mode, monitor and exit
157
155
if monitor {
158
156
mon := newMonitor (c .Ui , client , length )
@@ -178,6 +176,30 @@ func (c *EvalStatusCommand) Run(args []string) int {
178
176
return 0
179
177
}
180
178
179
+ placedAllocs , _ , err := client .Evaluations ().Allocations (eval .ID , nil )
180
+ if err != nil {
181
+ c .Ui .Error (fmt .Sprintf ("Error querying related allocations: %s" , err ))
182
+ return 1
183
+ }
184
+
185
+ c .formatEvalStatus (eval , placedAllocs , verbose , length )
186
+
187
+ hint , _ := c .Meta .showUIPath (UIHintContext {
188
+ Command : "eval status" ,
189
+ PathParams : map [string ]string {
190
+ "evalID" : eval .ID ,
191
+ },
192
+ OpenURL : openURL ,
193
+ })
194
+ if hint != "" {
195
+ c .Ui .Warn (hint )
196
+ }
197
+
198
+ return 0
199
+ }
200
+
201
+ func (c * EvalStatusCommand ) formatEvalStatus (eval * api.Evaluation , placedAllocs []* api.AllocationListStub , verbose bool , length int ) {
202
+
181
203
failureString , failures := evalFailureStatus (eval )
182
204
triggerNoun , triggerSubj := getTriggerDetails (eval )
183
205
statusDesc := eval .StatusDescription
@@ -220,16 +242,27 @@ func (c *EvalStatusCommand) Run(args []string) int {
220
242
basic = append (basic ,
221
243
fmt .Sprintf ("Wait Until|%s" , formatTime (eval .WaitUntil )))
222
244
}
223
-
224
- if verbose {
225
- // NextEval, PreviousEval, BlockedEval
245
+ if eval .QuotaLimitReached != "" {
226
246
basic = append (basic ,
227
- fmt .Sprintf ("Previous Eval|%s" , eval .PreviousEval ),
228
- fmt .Sprintf ("Next Eval|%s" , eval .NextEval ),
229
- fmt .Sprintf ("Blocked Eval|%s" , eval .BlockedEval ))
247
+ fmt .Sprintf ("Quota Limit Reached|%s" , eval .QuotaLimitReached ))
230
248
}
249
+ basic = append (basic ,
250
+ fmt .Sprintf ("Previous Eval|%s" , limit (eval .PreviousEval , length )),
251
+ fmt .Sprintf ("Next Eval|%s" , limit (eval .NextEval , length )),
252
+ fmt .Sprintf ("Blocked Eval|%s" , limit (eval .BlockedEval , length )),
253
+ )
231
254
c .Ui .Output (formatKV (basic ))
232
255
256
+ if len (eval .RelatedEvals ) > 0 {
257
+ c .Ui .Output (c .Colorize ().Color ("\n [bold]Related Evaluations[reset]" ))
258
+ c .Ui .Output (formatRelatedEvalStubs (eval .RelatedEvals , length ))
259
+ }
260
+ if len (placedAllocs ) > 0 {
261
+ c .Ui .Output (c .Colorize ().Color ("\n [bold]Placed Allocations[reset]" ))
262
+ allocsOut := formatAllocListStubs (placedAllocs , false , length )
263
+ c .Ui .Output (allocsOut )
264
+ }
265
+
233
266
if failures {
234
267
c .Ui .Output (c .Colorize ().Color ("\n [bold]Failed Placements[reset]" ))
235
268
sorted := sortedTaskGroupFromMetrics (eval .FailedTGAllocs )
@@ -240,29 +273,18 @@ func (c *EvalStatusCommand) Run(args []string) int {
240
273
if metrics .CoalescedFailures > 0 {
241
274
noun += "s"
242
275
}
243
- c .Ui .Output (fmt .Sprintf ("Task Group %q (failed to place %d %s):" , tg , metrics .CoalescedFailures + 1 , noun ))
276
+ c .Ui .Output (fmt .Sprintf ("Task Group %q (failed to place %d %s):" ,
277
+ tg , metrics .CoalescedFailures + 1 , noun ))
244
278
c .Ui .Output (formatAllocMetrics (metrics , false , " " ))
245
279
c .Ui .Output ("" )
246
280
}
247
281
248
282
if eval .BlockedEval != "" {
249
- c .Ui .Output (fmt .Sprintf ("Evaluation %q waiting for additional capacity to place remainder" ,
283
+ c .Ui .Output (fmt .Sprintf (
284
+ "Evaluation %q waiting for additional capacity to place remainder" ,
250
285
limit (eval .BlockedEval , length )))
251
286
}
252
287
}
253
-
254
- hint , _ := c .Meta .showUIPath (UIHintContext {
255
- Command : "eval status" ,
256
- PathParams : map [string ]string {
257
- "evalID" : eval .ID ,
258
- },
259
- OpenURL : openURL ,
260
- })
261
- if hint != "" {
262
- c .Ui .Warn (hint )
263
- }
264
-
265
- return 0
266
288
}
267
289
268
290
func sortedTaskGroupFromMetrics (groups map [string ]* api.AllocationMetric ) []string {
@@ -284,3 +306,20 @@ func getTriggerDetails(eval *api.Evaluation) (noun, subject string) {
284
306
return "" , ""
285
307
}
286
308
}
309
+
310
+ func formatRelatedEvalStubs (evals []* api.EvaluationStub , length int ) string {
311
+ out := make ([]string , len (evals )+ 1 )
312
+ out [0 ] = "ID|Priority|Triggered By|Node ID|Status|Description"
313
+ for i , eval := range evals {
314
+ out [i + 1 ] = fmt .Sprintf ("%s|%d|%s|%s|%s|%s" ,
315
+ limit (eval .ID , length ),
316
+ eval .Priority ,
317
+ eval .TriggeredBy ,
318
+ limit (eval .NodeID , length ),
319
+ eval .Status ,
320
+ eval .StatusDescription ,
321
+ )
322
+ }
323
+
324
+ return formatList (out )
325
+ }
0 commit comments