Keep progress writes outside model deadlines
This commit is contained in:
@@ -5,9 +5,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/reporting"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/outcomes"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/runner"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/structuredoutput"
|
||||
pk "go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
func runnerProgress(progress func(string)) func(runner.Progress) {
|
||||
@@ -31,8 +31,8 @@ func runnerProgress(progress func(string)) func(runner.Progress) {
|
||||
}
|
||||
}
|
||||
|
||||
func reportModelProgress(progress func(string), coordinates structuredoutput.DiagnosticContext, event pk.ExecutionEvent) {
|
||||
if coordinates.StageIndex == nil || (event.Kind != pk.ExecutionStarted && event.Kind != pk.ExecutionFinished) {
|
||||
func reportModelProgress(progress func(string), coordinates structuredoutput.DiagnosticContext, counts *outcomes.ExecutionCounts, err error) {
|
||||
if coordinates.StageIndex == nil {
|
||||
return
|
||||
}
|
||||
location := progressLocation(*coordinates.StageIndex, coordinates.ModuleKey, coordinates.StageID, coordinates.SectionIndex)
|
||||
@@ -49,11 +49,18 @@ func reportModelProgress(progress func(string), coordinates structuredoutput.Dia
|
||||
}
|
||||
operation += fmt.Sprintf(" turn %d", *coordinates.RepairAttempt)
|
||||
}
|
||||
if event.Kind == pk.ExecutionStarted {
|
||||
if counts == nil {
|
||||
progress(fmt.Sprintf("%s %s started", location, operation))
|
||||
} else {
|
||||
progress(fmt.Sprintf("%s %s finished (%s, %d provider attempts)", location, operation, event.Outcome, event.Attempts))
|
||||
return
|
||||
}
|
||||
outcome := "completed"
|
||||
if err != nil {
|
||||
outcome = "failed"
|
||||
}
|
||||
if counts.Available {
|
||||
outcome += fmt.Sprintf(", %d provider attempts", counts.ProviderAttempts)
|
||||
}
|
||||
progress(fmt.Sprintf("%s %s finished (%s)", location, operation, outcome))
|
||||
}
|
||||
|
||||
func progressLocation(index int, module string, id *string, section *int) string {
|
||||
|
||||
Reference in New Issue
Block a user