From a2e7a79493431557fa816041b9cf6deb1745aab5 Mon Sep 17 00:00:00 2001 From: gak Date: Thu, 18 Jul 2024 15:45:40 +1000 Subject: [PATCH] fix: more errors wrapped around deploy/reserve runners (#2113) Co-authored-by: Matt Toohey --- backend/controller/controller.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/controller/controller.go b/backend/controller/controller.go index 78c756af63..45c68ca4a9 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -1453,13 +1453,14 @@ func (s *Service) terminateRandomRunner(ctx context.Context, key model.Deploymen func (s *Service) deploy(ctx context.Context, reconcile model.Deployment) error { client, err := s.reserveRunner(ctx, reconcile) if err != nil { - return err + return fmt.Errorf("failed to reserve runner for %s: %w", reconcile.Key, err) } _, err = client.runner.Deploy(ctx, connect.NewRequest(&ftlv1.DeployRequest{DeploymentKey: reconcile.Key.String()})) if err != nil { - return err + return fmt.Errorf("failed to request deploy %s: %w", reconcile.Key, err) } + return nil } @@ -1477,8 +1478,13 @@ func (s *Service) reserveRunner(ctx context.Context, reconcile model.Deployment) err = dal.WithReservation(reservationCtx, claim, func() error { client = s.clientsForEndpoint(claim.Runner().Endpoint) _, err = client.runner.Reserve(reservationCtx, connect.NewRequest(&ftlv1.ReserveRequest{DeploymentKey: reconcile.Key.String()})) - return err + if err != nil { + return fmt.Errorf("failed request to reserve a runner for %s at %s: %w", reconcile.Key, claim.Runner().Endpoint, err) + } + + return nil }) + return }