Retain processing evidence only for selected outputs
This commit is contained in:
@@ -66,59 +66,35 @@ func Build(input BuildInput) reporting.Snapshot {
|
||||
return units[i].Section.Index < units[j].Section.Index
|
||||
})
|
||||
}
|
||||
total, started, completed, interrupted, notStarted, withErrors := len(units), 0, 0, 0, 0, 0
|
||||
corrections, llmOperations, proposalResponses, recoveryCount, filteringResponses := 0, 0, 0, 0, 0
|
||||
var measured outcomes.WorkTotals
|
||||
if input.RunOutput.Totals != nil {
|
||||
measured = *input.RunOutput.Totals
|
||||
} else {
|
||||
measured.Total = len(units)
|
||||
for _, unit := range units {
|
||||
measured.Record(unit.State, unit.Operations)
|
||||
measured.Corrections += unit.CorrectionsApplied
|
||||
}
|
||||
}
|
||||
for _, unit := range units {
|
||||
if unit.State == outcomes.WorkNotStarted {
|
||||
notStarted++
|
||||
} else {
|
||||
started++
|
||||
}
|
||||
if unit.State == outcomes.WorkCompleted {
|
||||
completed++
|
||||
}
|
||||
if unit.State == outcomes.WorkInterrupted {
|
||||
interrupted++
|
||||
}
|
||||
corrections += unit.CorrectionsApplied
|
||||
operations := unit.Operations
|
||||
if details {
|
||||
operations = append([]outcomes.Operation(nil), operations...)
|
||||
sort.SliceStable(operations, func(i, j int) bool { return operationLess(operations[i], operations[j]) })
|
||||
if !details {
|
||||
break
|
||||
}
|
||||
operations := append([]outcomes.Operation(nil), unit.Operations...)
|
||||
sort.SliceStable(operations, func(i, j int) bool { return operationLess(operations[i], operations[j]) })
|
||||
var failures []reporting.Failure
|
||||
unitHasError := false
|
||||
unitRecoveries := 0
|
||||
for _, operation := range operations {
|
||||
if operation.Reference.Kind != outcomes.OperationValidationInput {
|
||||
llmOperations++
|
||||
}
|
||||
if operation.Reference.Kind == outcomes.OperationProposal && operation.Succeeded {
|
||||
proposalResponses++
|
||||
}
|
||||
if operation.Succeeded && len(operation.RecoveryReasons) > 0 {
|
||||
recoveryCount++
|
||||
unitRecoveries++
|
||||
if len(operation.Filtered) > 0 && operation.Reference.Kind == outcomes.OperationProposal {
|
||||
filteringResponses++
|
||||
}
|
||||
if details {
|
||||
snapshot.Recoveries = append(snapshot.Recoveries, mapRecovery(unit, operation))
|
||||
}
|
||||
snapshot.Recoveries = append(snapshot.Recoveries, mapRecovery(unit, operation))
|
||||
}
|
||||
if operation.FailureClass == outcomes.FailureRecoverable {
|
||||
unitHasError = true
|
||||
if details {
|
||||
failures = append(failures, mapFailure(operation))
|
||||
}
|
||||
failures = append(failures, mapFailure(operation))
|
||||
}
|
||||
}
|
||||
if unitHasError {
|
||||
withErrors++
|
||||
}
|
||||
if !details {
|
||||
continue
|
||||
}
|
||||
row := reporting.WorkUnit{StageIndex: unit.ModuleIndex, StageID: unit.StageID, ModuleKey: unit.ModuleKey, ModuleInstance: unit.ModuleInstance,
|
||||
ChunkIndex: unit.Section.Index, StartSegmentID: unit.Section.StartSegmentID, EndSegmentID: unit.Section.EndSegmentID,
|
||||
State: string(unit.State), CorrectionsApplied: unit.CorrectionsApplied, RecoveryCount: unitRecoveries}
|
||||
@@ -153,12 +129,13 @@ func Build(input BuildInput) reporting.Snapshot {
|
||||
return a.ProposalIndex < b.ProposalIndex
|
||||
})
|
||||
runErrors := len(failures)
|
||||
interrupted, notStarted := measured.Started-measured.Completed, measured.Total-measured.Started
|
||||
snapshot.Summary = reporting.Summary{
|
||||
WorkUnitsTotal: &total, WorkUnitsStarted: &started, WorkUnitsCompleted: &completed,
|
||||
WorkUnitsInterrupted: &interrupted, WorkUnitsNotStarted: ¬Started, WorkUnitsWithErrors: &withErrors,
|
||||
RunErrors: &runErrors, CorrectionsApplied: &corrections, LLMOperations: &llmOperations,
|
||||
ProposalResponses: &proposalResponses, Recoveries: &recoveryCount,
|
||||
ProposalResponsesWithFiltering: &filteringResponses,
|
||||
WorkUnitsTotal: &measured.Total, WorkUnitsStarted: &measured.Started, WorkUnitsCompleted: &measured.Completed,
|
||||
WorkUnitsInterrupted: &interrupted, WorkUnitsNotStarted: ¬Started, WorkUnitsWithErrors: &measured.WithErrors,
|
||||
RunErrors: &runErrors, CorrectionsApplied: &measured.Corrections, LLMOperations: &measured.ModelOperations,
|
||||
ProposalResponses: &measured.ProposalResponses, Recoveries: &measured.Recoveries,
|
||||
ProposalResponsesWithFiltering: &measured.FilteringResponses,
|
||||
}
|
||||
} else if len(failures) > 0 {
|
||||
runErrors := len(failures)
|
||||
|
||||
Reference in New Issue
Block a user