Skip to content

Commit

Permalink
Add a stat for number of BUILD files currently parsing (#3290)
Browse files Browse the repository at this point in the history
* Add a stat for number of BUILD files currently parsing

* version
  • Loading branch information
peterebden authored Nov 8, 2024
1 parent c9be955 commit 83e0243
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 17.12.5
---------------
* Add a stat for number of BUILD files currently parsing (#3290)

Version 17.12.4
---------------
* Reverted back to arcat v1.0.2 while we work out behavioural issues
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.12.4
17.12.5
6 changes: 6 additions & 0 deletions src/core/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ type stateProgress struct {
numActive int64
numPending int64
numDone int64
numParses atomic.Int64
mutex sync.Mutex
closeOnce sync.Once
resultOnce sync.Once
Expand Down Expand Up @@ -370,6 +371,11 @@ func (state *BuildState) AddPendingTest(target *BuildTarget) {
}
}

// Parses returns the number of current parse tasks
func (state *BuildState) Parses() *atomic.Int64 {
return &state.progress.numParses
}

func (state *BuildState) addPendingTest(target *BuildTarget, numRuns int) {
atomic.AddInt64(&state.progress.numPending, int64(numRuns))
go func() {
Expand Down
2 changes: 1 addition & 1 deletion src/output/interactive_display.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type plainDisplay struct {

func (d *plainDisplay) Update(targets []buildingTarget) {
localbusy, remotebusy := countActive(targets)
log.Notice("Build running for %s, %d / %d tasks done, %s busy", time.Since(d.state.StartTime).Round(time.Second), d.state.NumDone(), d.state.NumActive(), pluralise(localbusy+remotebusy, "worker", "workers"))
log.Notice("Build running for %s, %d / %d tasks done, %s busy, parsing %d BUILD files", time.Since(d.state.StartTime).Round(time.Second), d.state.NumDone(), d.state.NumActive(), pluralise(localbusy+remotebusy, "worker", "workers"), d.state.Parses().Load())
}

func countActive(targets []buildingTarget) (local int, remote int) {
Expand Down
2 changes: 2 additions & 0 deletions src/plz/plz.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func Run(targets, preTargets []core.BuildLabel, state *core.BuildState, config *
go func() {
for task := range parses {
go func(task core.ParseTask) {
state.Parses().Add(1)
parse.Parse(state, task.Label, task.Dependent, task.Mode)
state.Parses().Add(-1)
state.TaskDone()
}(task)
}
Expand Down

0 comments on commit 83e0243

Please sign in to comment.