Skip to content

Feature 4534 component tracking - #4583

Merged
vito merged 12 commits into
masterfrom
feature-4534-component-tracking
Oct 22, 2019
Merged

vito merged 12 commits into
masterfrom
feature-4534-component-tracking

Conversation

@xtremerui

@xtremerui xtremerui commented Oct 8, 2019 •

Copy link
Copy Markdown
Contributor

Existing Issue

Fixes #4534

Changes proposed in this pull request

Added a table to track components last ran time and paused status. The interval of each component is seeded in DB during migration. While ATC starting up it will override those intervals with flag vars.

The runner (who runs the component) interval is default to 10s i.e. it will check if the component is paused every 10s. If component is unpaused it will proceed to check if the component run interval is reached.

Contributor Checklist

Reviewer Checklist

  • Code reviewed
  • Tests reviewed
  • Documentation reviewed
  • Release notes reviewed
  • PR acceptance performed

@xtremerui
xtremerui requested review from a team, cirocosta, ddadlani and vito October 8, 2019 20:49
@xtremerui
xtremerui force-pushed the feature-4534-component-tracking branch from 0e5b5cb to 6489761 Compare October 8, 2019 21:19
Comment thread atc/lidar/interval_runner.go Resolved

@cirocosta cirocosta 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.

few nits

Comment thread atc/atccmd/command.go Resolved
Comment thread atc/component.go Resolved
Comment thread atc/db/component.go Resolved

@ddadlani ddadlani 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.

Is there a danger of running into a scenario where one ATC is holding the lock for a component, but gets stuck doing something, and therefore no other ATC can run it? E.g. one ATC has the build tracker lock, but gets stuck running a build, and now no builds will run?

Comment thread atc/builds/tracker_runner.go Resolved
Comment thread atc/builds/tracker_runner_test.go Resolved
@xtremerui
xtremerui force-pushed the feature-4534-component-tracking branch 2 times, most recently from de35e9c to 517bc6f Compare October 10, 2019 16:49
@jwntrs

jwntrs commented Oct 11, 2019 •

Copy link
Copy Markdown
Contributor

@ddadlani this doesn't actually introduce any locking that we don't already have. In general we avoid exactly what you're talking about by locking on each individual build/check and not at any global level.

@xtremerui
xtremerui force-pushed the feature-4534-component-tracking branch from 517bc6f to 1cdbc07 Compare October 11, 2019 16:26
@jwntrs

jwntrs commented Oct 11, 2019

Copy link
Copy Markdown
Contributor

@ddadlani so what I said in #4583 (comment) no longer applies.

Things changed in 3ada330 in order to address @cirocosta concerns over race conditions. Each component now holds a lock before running. Technically this mostly just moves locks around, but it does also introduce a top level lock for the build tracker and resource checker. It shouldn't introduce any of the problems you listed, since the lock isn't held for the duration of the builds or checks themselves.

@jwntrs
jwntrs force-pushed the feature-4534-component-tracking branch from dde0b46 to 35d0ff7 Compare October 17, 2019 16:06
@jwntrs
jwntrs requested review from cirocosta and ddadlani October 18, 2019 15:11

@vito vito 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.

Overall 👍 - just a few nits/questions


CREATE UNIQUE INDEX components_name_key ON components (name);

INSERT INTO components(name, interval) VALUES

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.

Can/should we avoid this by turning the UpdateIntervals into an upsert/sync of all components? I didn't expect to maintain these as part of a migration. When we add a new migration would we need a migration to add the component?

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.

yup good point, fixed in ef0fd22

Comment thread atc/gc/build_log_collector.go Resolved
Comment thread atc/gc/container_collector.go Resolved
Comment thread atc/gc/resource_cache_collector.go Resolved
Comment thread atc/gc/resource_cache_use_collector.go Resolved
Comment thread atc/gc/volume_collector.go Resolved
Comment thread atc/gc/worker_collector.go Resolved
Comment thread atc/lidar/interval_runner.go Resolved
Comment thread atc/lockrunner/runner.go
case <-signals:
return nil
}
) *runner {

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.

This seems to have a lot of overlap with the interval runner. Do we need both? Is the only difference that this doesn't use a channel to short-circuit? (No big deal either way I guess.)

Comment thread atc/pipelines/syncer.go
return
}

if component.Paused() {

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.

lol gross but there's a reason we're eliminating the syncer 👍

Rui Yang and others added 12 commits October 22, 2019 14:58
Signed-off-by: Rui Yang <[email protected]>
Co-authored-by: Joshua Winters <[email protected]>
Signed-off-by: Rui Yang <[email protected]>
Co-authored-by: Joshua Winters <[email protected]>
Rui Yang Joshua Winters
atc: override components intervals based on ENV value

Signed-off-by: Rui Yang <[email protected]>
Co-authored-by: Joshua Winters <[email protected]>
Signed-off-by: Rui Yang <[email protected]>
Co-authored-by: Joshua Winters <[email protected]>
Signed-off-by: Rui Yang <[email protected]>
Co-authored-by: Joshua Winters <[email protected]>
Signed-off-by: Rui Yang <[email protected]>
Signed-off-by: Joshua Winters <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
Signed-off-by: Joshua Winters <[email protected]>
Co-authored-by: Julia Pu <[email protected]>
Co-authored-by: Clara Fu <[email protected]>
@jwntrs
jwntrs force-pushed the feature-4534-component-tracking branch from 12adf3b to ef0fd22 Compare October 22, 2019 18:59

@vito vito 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.

👍 - shall I wait to merge until we consolidate the runners?

@vito
vito merged commit e8a1874 into master Oct 22, 2019
@vito
vito deleted the feature-4534-component-tracking branch October 22, 2019 21:42
@jwntrs jwntrs mentioned this pull request Oct 28, 2019
1 of 2 tasks
@jamieklassen jamieklassen added the release/documented Documentation and release notes have been updated. label Oct 30, 2019
@jamieklassen jamieklassen added this to the v5.7.0 milestone Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/documented Documentation and release notes have been updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concourse deployment wide component tracking

6 participants