Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Change the executor state machine #109

Merged
merged 5 commits into from
May 15, 2018
Merged

Change the executor state machine #109

merged 5 commits into from
May 15, 2018

Conversation

sargun
Copy link
Contributor

@sargun sargun commented May 9, 2018

No description provided.

@coveralls
Copy link

coveralls commented May 9, 2018

Pull Request Test Coverage Report for Build 849

  • 26 of 174 (14.94%) changed or added relevant lines in 2 files are covered.
  • 47 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.2%) to 25.794%

Changes Missing Coverage Covered Lines Changed/Added Lines %
executor/runner/runner.go 26 45 57.78%
executor/runtime/docker/docker.go 0 129 0.0%
Files with Coverage Reduction New Missed Lines %
executor/runner/runner.go 1 53.57%
executor/runtime/docker/docker.go 5 2.37%
darion/api/handlers.go 41 69.7%
Totals Coverage Status
Change from base Build 839: 0.2%
Covered Lines: 2397
Relevant Lines: 9293

💛 - Coveralls

@codecov
Copy link

codecov bot commented May 9, 2018

Codecov Report

Merging #109 into master will increase coverage by 0.44%.
The diff coverage is 70.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
+ Coverage   35.04%   35.48%   +0.44%     
==========================================
  Files          65       65              
  Lines        7294     7349      +55     
==========================================
+ Hits         2556     2608      +52     
- Misses       4433     4436       +3     
  Partials      305      305
Impacted Files Coverage Δ
executor/runtime/types/types.go 84.31% <ø> (ø) ⬆️
config/config.go 97% <ø> (-0.08%) ⬇️
executor/mock/jobrunner.go 74.56% <ø> (-0.23%) ⬇️
executor/runtime/docker/docker.go 50.74% <69.52%> (+1.69%) ⬆️
executor/runner/runner.go 63.05% <74.35%> (+3.05%) ⬆️
darion/api/handlers.go 60.78% <0%> (-4.74%) ⬇️
launchguard/client/client.go 75.42% <0%> (+2.54%) ⬆️
launchguard/core/launchguard.go 87.03% <0%> (+3.7%) ⬆️

@sargun
Copy link
Contributor Author

sargun commented May 12, 2018

btw -- coveralls ONLY looks at local tests, whereas codecov merges standalone + local tests.

@@ -349,6 +352,26 @@ no_launchguard:
}
}

func (r *Runner) handleTaskRunningMessage(ctx context.Context, msg string, lastMessage *string, runningSent *bool, startTime time.Time, details *runtimeTypes.Details) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists mostly to keep the cyclomatic complexity of the monitorContainer function low.

@sargun sargun force-pushed the change-state-machine branch 2 times, most recently from 2d00719 to b9a9c9b Compare May 14, 2018 19:16
Copy link
Contributor

@fabiokung fabiokung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 I like these changes a lot, and only left some minor comments.

r.logger.Info("Status: ", titusTaskStatus.String())
// TODO: Generate Update
r.updateStatus(ctx, titusTaskStatus, msg)
case statusMessage := <-statusChan:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to handle statusChan being closed too, no? It seems it will be closed when we can't talk to the docker daemon anymore, in which case this will cause a panic: nil pointer. At least failing more gracefully and sending the StatusUpdate.Lost message may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

defer close(statusMessageChan)
defer cancel()

// This context should be tied to the lifetime of the container -- it wille get significantly less broken
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: typo in it wille?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
case "health_status":
statusMessageChan <- runtimeTypes.StatusMessage{
Status: runtimeTypes.StatusRunning,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a Msg here indicating the change in health_status?

}

r.metrics.Timer("titus.executor.dockerStartTime", time.Since(dockerStartStartTime), c.ImageTagForMetrics())

if c.Allocation.IPV4Address == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check c.Allocation.ENI or DeviceIndex, as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you're running this in "old network driver mode" those are unset.

return
} else if details == nil {
r.logger.Error("Unable to fetch task details")
if details == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth checking this before err != nil above? Otherwise, we just updated a bunch of status with nil details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah -- because details might be nil, for example, if we weren't able to start the image, because of a bad entrypoint. This here is more a sanity-check, and should never happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- In those cases, the error will get reported back to the user, and the program wont shut down entirely.

@sargun sargun merged commit 805f6d2 into master May 15, 2018
@sargun sargun deleted the change-state-machine branch May 15, 2018 02:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants