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
c9340637
Commit
c9340637
authored
8 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
FinishedAt only records when the task has actually started
parent
e5476981
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/alloc_runner.go
+5
-2
client/alloc_runner.go
client/alloc_runner_test.go
+0
-3
client/alloc_runner_test.go
with
5 additions
and
5 deletions
+5
-5
client/alloc_runner.go
+
5
-
2
View file @
c9340637
...
...
@@ -388,8 +388,11 @@ func (r *AllocRunner) setTaskState(taskName, state string, event *structs.TaskEv
taskState
.
StartedAt
=
time
.
Now
()
.
UTC
()
}
case
structs
.
TaskStateDead
:
// Capture the finished time
taskState
.
FinishedAt
=
time
.
Now
()
.
UTC
()
// Capture the finished time. If it has never started there is no finish
// time
if
!
taskState
.
StartedAt
.
IsZero
()
{
taskState
.
FinishedAt
=
time
.
Now
()
.
UTC
()
}
// Find all tasks that are not the one that is dead and check if the one
// that is dead is a leader
...
...
This diff is collapsed.
Click to expand it.
client/alloc_runner_test.go
+
0
-
3
View file @
c9340637
...
...
@@ -633,9 +633,6 @@ func TestAllocRunner_TaskFailed_KillTG(t *testing.T) {
if
state1
.
State
!=
structs
.
TaskStateDead
{
return
false
,
fmt
.
Errorf
(
"got state %v; want %v"
,
state1
.
State
,
structs
.
TaskStateDead
)
}
if
state1
.
FinishedAt
.
IsZero
()
||
state1
.
StartedAt
.
IsZero
()
{
return
false
,
fmt
.
Errorf
(
"expected to have a start and finish time"
)
}
if
len
(
state1
.
Events
)
<
2
{
// At least have a received and destroyed
return
false
,
fmt
.
Errorf
(
"Unexpected number of events"
)
...
...
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