chore: add nil check for validation metrics
Currently, there is an assumption in the master that metrics be present in completed validations. This change makes this assumption explicit, rather than implicit, and changes what is now a panic to an error.
@@ -293,6 +293,10 @@ func (e *experiment) Receive(ctx *actor.Context) error {
e.searcher.WorkloadCompleted(msg.completedMessage, msg.unitsCompleted)
e.processOperations(ctx, nil, nil) // we call processOperations to flush searcher events.
if msg.completedMessage.Workload.Kind == searcher.ComputeValidationMetrics {
+ if msg.completedMessage.ValidationMetrics == nil {
+ return fmt.Errorf("completed validation workload missing metrics %s",
+ msg.completedMessage.Workload)
+ }
ctx.Respond(e.isBestValidation(*msg.completedMessage.ValidationMetrics))
}
progress := e.searcher.Progress()
