Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
92bddbc3
Commit
92bddbc3
authored
9 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
rename SpawnedBlockedEval and simplify map safety check
parent
9f5ab664
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
api/evaluations.go
+17
-17
api/evaluations.go
command/monitor.go
+3
-3
command/monitor.go
nomad/structs/structs.go
+4
-4
nomad/structs/structs.go
scheduler/generic_sched.go
+4
-6
scheduler/generic_sched.go
scheduler/generic_sched_test.go
+3
-3
scheduler/generic_sched_test.go
scheduler/system_sched.go
+1
-1
scheduler/system_sched.go
scheduler/util.go
+1
-1
scheduler/util.go
scheduler/util_test.go
+2
-2
scheduler/util_test.go
with
35 additions
and
37 deletions
+35
-37
api/evaluations.go
+
17
-
17
View file @
92bddbc3
...
...
@@ -54,23 +54,23 @@ func (e *Evaluations) Allocations(evalID string, q *QueryOptions) ([]*Allocation
// Evaluation is used to serialize an evaluation.
type
Evaluation
struct
{
ID
string
Priority
int
Type
string
TriggeredBy
string
JobID
string
JobModifyIndex
uint64
NodeID
string
NodeModifyIndex
uint64
Status
string
StatusDescription
string
Wait
time
.
Duration
NextEval
string
PreviousEval
string
Spawned
BlockedEval
string
FailedTGAllocs
map
[
string
]
*
AllocationMetric
CreateIndex
uint64
ModifyIndex
uint64
ID
string
Priority
int
Type
string
TriggeredBy
string
JobID
string
JobModifyIndex
uint64
NodeID
string
NodeModifyIndex
uint64
Status
string
StatusDescription
string
Wait
time
.
Duration
NextEval
string
PreviousEval
string
BlockedEval
string
FailedTGAllocs
map
[
string
]
*
AllocationMetric
CreateIndex
uint64
ModifyIndex
uint64
}
// EvalIndexSort is a wrapper to sort evaluations by CreateIndex.
...
...
This diff is collapsed.
Click to expand it.
command/monitor.go
+
3
-
3
View file @
92bddbc3
...
...
@@ -307,9 +307,9 @@ func (m *monitor) monitor(evalID string, allowPrefix bool) int {
dumpAllocMetrics
(
m
.
ui
,
metrics
,
false
)
}
if
eval
.
Spawned
BlockedEval
!=
""
{
m
.
ui
.
Output
(
fmt
.
Sprintf
(
"
Spawned follow up blocked evaluation %q
to place remainder"
,
limit
(
eval
.
Spawned
BlockedEval
,
m
.
length
)))
if
eval
.
BlockedEval
!=
""
{
m
.
ui
.
Output
(
fmt
.
Sprintf
(
"
Evaluation %q waiting for additional capacity
to place remainder"
,
limit
(
eval
.
BlockedEval
,
m
.
length
)))
}
}
default
:
...
...
This diff is collapsed.
Click to expand it.
nomad/structs/structs.go
+
4
-
4
View file @
92bddbc3
...
...
@@ -2617,10 +2617,10 @@ type Evaluation struct {
// This is used to support rolling upgrades, where we need a chain of evaluations.
PreviousEval
string
//
Spawned
BlockedEval is the evaluation ID for a created blocked eval. A
// BlockedEval is the evaluation ID for a created blocked eval. A
// blocked eval will be created if all allocations could not be placed due
// to constraints or lacking resources.
Spawned
BlockedEval
string
BlockedEval
string
// FailedTGAllocs are task groups which have allocations that could not be
// made, but the metrics are persisted so that the user can use the feedback
...
...
@@ -2744,10 +2744,10 @@ func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation {
}
}
// BlockedEval creates a blocked evaluation to followup this eval to place any
//
Create
BlockedEval creates a blocked evaluation to followup this eval to place any
// failed allocations. It takes the classes marked explicitly eligible or
// ineligible and whether the job has escaped computed node classes.
func
(
e
*
Evaluation
)
BlockedEval
(
classEligibility
map
[
string
]
bool
,
escaped
bool
)
*
Evaluation
{
func
(
e
*
Evaluation
)
Create
BlockedEval
(
classEligibility
map
[
string
]
bool
,
escaped
bool
)
*
Evaluation
{
return
&
Evaluation
{
ID
:
GenerateUUID
(),
Priority
:
e
.
Priority
,
...
...
This diff is collapsed.
Click to expand it.
scheduler/generic_sched.go
+
4
-
6
View file @
92bddbc3
...
...
@@ -140,7 +140,7 @@ func (s *GenericScheduler) createBlockedEval() error {
classEligibility
=
e
.
GetClasses
()
}
s
.
blocked
=
s
.
eval
.
BlockedEval
(
classEligibility
,
escaped
)
s
.
blocked
=
s
.
eval
.
Create
BlockedEval
(
classEligibility
,
escaped
)
return
s
.
planner
.
CreateEval
(
s
.
blocked
)
}
...
...
@@ -370,11 +370,9 @@ func (s *GenericScheduler) computePlacements(place []allocTuple) error {
for
_
,
missing
:=
range
place
{
// Check if this task group has already failed
if
s
.
eval
.
FailedTGAllocs
!=
nil
{
if
metric
,
ok
:=
s
.
eval
.
FailedTGAllocs
[
missing
.
TaskGroup
.
Name
];
ok
{
metric
.
CoalescedFailures
+=
1
continue
}
if
metric
,
ok
:=
s
.
eval
.
FailedTGAllocs
[
missing
.
TaskGroup
.
Name
];
ok
{
metric
.
CoalescedFailures
+=
1
continue
}
// Attempt to match the task group
...
...
This diff is collapsed.
Click to expand it.
scheduler/generic_sched_test.go
+
3
-
3
View file @
92bddbc3
...
...
@@ -51,7 +51,7 @@ func TestServiceSched_JobRegister(t *testing.T) {
// Ensure the eval has no spawned blocked eval
if
len
(
h
.
Evals
)
!=
1
{
t
.
Fatalf
(
"bad: %#v"
,
h
.
Evals
)
if
h
.
Evals
[
0
]
.
Spawned
BlockedEval
!=
""
{
if
h
.
Evals
[
0
]
.
BlockedEval
!=
""
{
t
.
Fatalf
(
"bad: %#v"
,
h
.
Evals
[
0
])
}
}
...
...
@@ -248,7 +248,7 @@ func TestServiceSched_JobRegister_AllocFail(t *testing.T) {
outEval
:=
h
.
Evals
[
0
]
// Ensure the eval has its spawned blocked eval
if
outEval
.
Spawned
BlockedEval
!=
h
.
CreateEvals
[
0
]
.
ID
{
if
outEval
.
BlockedEval
!=
h
.
CreateEvals
[
0
]
.
ID
{
t
.
Fatalf
(
"bad: %#v"
,
outEval
)
}
...
...
@@ -432,7 +432,7 @@ func TestServiceSched_JobRegister_FeasibleAndInfeasibleTG(t *testing.T) {
outEval
:=
h
.
Evals
[
0
]
// Ensure the eval has its spawned blocked eval
if
outEval
.
Spawned
BlockedEval
!=
h
.
CreateEvals
[
0
]
.
ID
{
if
outEval
.
BlockedEval
!=
h
.
CreateEvals
[
0
]
.
ID
{
t
.
Fatalf
(
"bad: %#v"
,
outEval
)
}
...
...
This diff is collapsed.
Click to expand it.
scheduler/system_sched.go
+
1
-
1
View file @
92bddbc3
...
...
@@ -237,7 +237,7 @@ func (s *SystemScheduler) computePlacements(place []allocTuple) error {
// Attempt to match the task group
option
,
_
:=
s
.
stack
.
Select
(
missing
.
TaskGroup
)
if
option
==
nil
&&
s
.
eval
.
FailedTGAllocs
!=
nil
{
if
option
==
nil
{
// Check if this task group has already failed
if
metric
,
ok
:=
s
.
eval
.
FailedTGAllocs
[
missing
.
TaskGroup
.
Name
];
ok
{
metric
.
CoalescedFailures
+=
1
...
...
This diff is collapsed.
Click to expand it.
scheduler/util.go
+
1
-
1
View file @
92bddbc3
...
...
@@ -365,7 +365,7 @@ func setStatus(logger *log.Logger, planner Planner, eval, nextEval, spawnedBlock
newEval
.
NextEval
=
nextEval
.
ID
}
if
spawnedBlocked
!=
nil
{
newEval
.
Spawned
BlockedEval
=
spawnedBlocked
.
ID
newEval
.
BlockedEval
=
spawnedBlocked
.
ID
}
return
planner
.
UpdateEval
(
newEval
)
}
...
...
This diff is collapsed.
Click to expand it.
scheduler/util_test.go
+
2
-
2
View file @
92bddbc3
...
...
@@ -526,8 +526,8 @@ func TestSetStatus(t *testing.T) {
}
newEval
=
h
.
Evals
[
0
]
if
newEval
.
Spawned
BlockedEval
!=
blocked
.
ID
{
t
.
Fatalf
(
"setStatus() didn't set
Spawned
BlockedEval correctly: %v"
,
newEval
)
if
newEval
.
BlockedEval
!=
blocked
.
ID
{
t
.
Fatalf
(
"setStatus() didn't set BlockedEval correctly: %v"
,
newEval
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment