Skip to content

engine: build and deployers should return results for targets they built, and#3374

Merged
nicks merged 1 commit into
masterfrom
nicks/noop
May 27, 2020
Merged

engine: build and deployers should return results for targets they built, and#3374
nicks merged 1 commit into
masterfrom
nicks/noop

Conversation

@nicks

@nicks nicks commented May 22, 2020

Copy link
Copy Markdown
Contributor

Hello @landism, @maiamcc,

Please review the following commits I made in branch nicks/noop:

a935df3 (2020-05-22 18:03:01 -0400)
engine: build and deployers should return results for targets they built, and not return results for targets they didn't build.
This should make #3362
much simpler and easy to reason about.

Also adds test harnesses for different build graph configurations.

4fb8808 (2020-05-22 16:40:23 -0400)
engine: remove last build state from the target queue build handlers

Code review reminders, by giving a LGTM you attest that:

  • Commits are adequately tested
  • Code is easy to understand and conforms to style guides
  • Incomplete code is marked with TODOs
  • Code is suitably instrumented with logging and metrics

@nicks
nicks requested review from landism and maiamcc May 22, 2020 22:06
@nicks
nicks changed the base branch from master to nicks/targetqueue May 22, 2020 22:08
@nicks
nicks force-pushed the nicks/noop branch 4 times, most recently from b30b89d to 16b9304 Compare May 26, 2020 14:16
Base automatically changed from nicks/targetqueue to master May 26, 2020 15:52
@nicks

nicks commented May 26, 2020

Copy link
Copy Markdown
Contributor Author

rebased!

@maiamcc maiamcc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@@ -23,6 +23,10 @@ type BuildAndDeployer interface {
//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you could compress these comments (from "Returns a..." onward). Something like:

Returns a BuildResultSet containing output (build result and associated file changes) for each target built in this call. (The BuildResultSet only contains results for newly built targets--if a target was clean and didn't need to be built, it doesn't appear in the result set.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

func (q *TargetQueue) Results() store.BuildResultSet {
return q.results
// New results that we built with a BuildHandler. Omits results
// that were re-used previous builds.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't care HOW we built them (aren't all results built with a BuildHander?), I care WHEN we built them. "Results that were build in the current call (omits results...)" or something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

func (q *TargetQueue) NewResults() store.BuildResultSet {
newResults := store.BuildResultSet{}
for id, result := range q.results {
if q.IsDirty(id) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand why this works but the verbiage is confusing ("IsDirty" makes me think it STILL needs a build??). Not a big deal to leave as-is but i wonder if there exists a comment that would clarify?

Suggested change
if q.IsDirty(id) {
if q.IsDirty(id) { // i.e. WASDirty() -- if True, we built this target afresh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed it to a private method and renamed it isBuilding

newResults := q.NewResults()
if err != nil {
return store.BuildResultSet{}, buildcontrol.WrapDontFallBackError(err)
return newResults, buildcontrol.WrapDontFallBackError(err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmmm so this results set ought to only contain results for targets we actually built this time, IF we built them successfully, right? (just checking my understanding)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep

…ilt, and

not return results for targets they didn't build.

This should make #3362
much simpler and easy to reason about.

Also adds test harnesses for different build graph configurations.
@nicks
nicks merged commit 6c08014 into master May 27, 2020
@nicks
nicks deleted the nicks/noop branch May 27, 2020 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants