From 83e0243eba98ba55daf1d3b0d562eb494f5502d7 Mon Sep 17 00:00:00 2001 From: Peter Ebden Date: Fri, 8 Nov 2024 11:27:38 +0000 Subject: [PATCH] Add a stat for number of BUILD files currently parsing (#3290) * Add a stat for number of BUILD files currently parsing * version --- ChangeLog | 4 ++++ VERSION | 2 +- src/core/state.go | 6 ++++++ src/output/interactive_display.go | 2 +- src/plz/plz.go | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbc439ba46..9dd0b1529c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/VERSION b/VERSION index e143243927..a93455c713 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -17.12.4 +17.12.5 diff --git a/src/core/state.go b/src/core/state.go index f98cce26cc..da61ef2a26 100644 --- a/src/core/state.go +++ b/src/core/state.go @@ -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 @@ -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() { diff --git a/src/output/interactive_display.go b/src/output/interactive_display.go index c642238b3d..503fcdd23f 100644 --- a/src/output/interactive_display.go +++ b/src/output/interactive_display.go @@ -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) { diff --git a/src/plz/plz.go b/src/plz/plz.go index fac5e036f8..0eba009518 100644 --- a/src/plz/plz.go +++ b/src/plz/plz.go @@ -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) }