Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
8de254c5
Unverified
Commit
8de254c5
authored
6 years ago
by
Nick Ethier
Browse files
Options
Download
Email Patches
Plain Diff
nomad: lookup job instead of adding Dispatched to summary
parent
af3f535f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
nomad/leader.go
+5
-1
nomad/leader.go
nomad/state/state_store.go
+3
-5
nomad/state/state_store.go
nomad/structs/structs.go
+0
-3
nomad/structs/structs.go
with
8 additions
and
9 deletions
+8
-9
nomad/leader.go
+
5
-
1
View file @
8de254c5
...
@@ -624,7 +624,11 @@ func (s *Server) publishJobSummaryMetrics(stopCh chan struct{}) {
...
@@ -624,7 +624,11 @@ func (s *Server) publishJobSummaryMetrics(stopCh chan struct{}) {
break
break
}
}
summary
:=
raw
.
(
*
structs
.
JobSummary
)
summary
:=
raw
.
(
*
structs
.
JobSummary
)
if
s
.
config
.
DisableDispatchedJobSummaryMetrics
&&
summary
.
Dispatched
{
job
,
err
:=
state
.
JobByID
(
ws
,
summary
.
Namespace
,
summary
.
JobID
)
if
err
!=
nil
{
s
.
logger
.
Printf
(
"[ERR] nomad: failed to lookup job for summary: %v"
,
err
)
}
if
s
.
config
.
DisableDispatchedJobSummaryMetrics
&&
job
.
Dispatched
{
continue
continue
}
}
s
.
iterateJobSummaryMetrics
(
summary
)
s
.
iterateJobSummaryMetrics
(
summary
)
...
...
This diff is collapsed.
Click to expand it.
nomad/state/state_store.go
+
3
-
5
View file @
8de254c5
...
@@ -3050,10 +3050,9 @@ func (s *StateStore) ReconcileJobSummaries(index uint64) error {
...
@@ -3050,10 +3050,9 @@ func (s *StateStore) ReconcileJobSummaries(index uint64) error {
// Create a job summary for the job
// Create a job summary for the job
summary
:=
&
structs
.
JobSummary
{
summary
:=
&
structs
.
JobSummary
{
JobID
:
job
.
ID
,
JobID
:
job
.
ID
,
Namespace
:
job
.
Namespace
,
Namespace
:
job
.
Namespace
,
Summary
:
make
(
map
[
string
]
structs
.
TaskGroupSummary
),
Summary
:
make
(
map
[
string
]
structs
.
TaskGroupSummary
),
Dispatched
:
job
.
Dispatched
,
}
}
for
_
,
tg
:=
range
job
.
TaskGroups
{
for
_
,
tg
:=
range
job
.
TaskGroups
{
summary
.
Summary
[
tg
.
Name
]
=
structs
.
TaskGroupSummary
{}
summary
.
Summary
[
tg
.
Name
]
=
structs
.
TaskGroupSummary
{}
...
@@ -3350,7 +3349,6 @@ func (s *StateStore) updateSummaryWithJob(index uint64, job *structs.Job,
...
@@ -3350,7 +3349,6 @@ func (s *StateStore) updateSummaryWithJob(index uint64, job *structs.Job,
Summary
:
make
(
map
[
string
]
structs
.
TaskGroupSummary
),
Summary
:
make
(
map
[
string
]
structs
.
TaskGroupSummary
),
Children
:
new
(
structs
.
JobChildrenSummary
),
Children
:
new
(
structs
.
JobChildrenSummary
),
CreateIndex
:
index
,
CreateIndex
:
index
,
Dispatched
:
job
.
Dispatched
,
}
}
hasSummaryChanged
=
true
hasSummaryChanged
=
true
}
}
...
...
This diff is collapsed.
Click to expand it.
nomad/structs/structs.go
+
0
-
3
View file @
8de254c5
...
@@ -3593,9 +3593,6 @@ type JobSummary struct {
...
@@ -3593,9 +3593,6 @@ type JobSummary struct {
// Children contains a summary for the children of this job.
// Children contains a summary for the children of this job.
Children
*
JobChildrenSummary
Children
*
JobChildrenSummary
// Dispatched is true if this job is dispatched from a parameterized job
Dispatched
bool
// Raft Indexes
// Raft Indexes
CreateIndex
uint64
CreateIndex
uint64
ModifyIndex
uint64
ModifyIndex
uint64
...
...
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
Menu
Projects
Groups
Snippets
Help