Skip to content

Commit

Permalink
move call and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dleviminzi committed Mar 6, 2025
1 parent 000a522 commit dfddb44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ func (s *Scheduler) StartProcessingRequests() {
continue
}

// Add the container cost per ms to the request if a cost endpoint is provided
s.addContainerCostPerMs(request)

// Find a worker to schedule ContainerRequests on
worker, err := s.selectWorker(request)
if err != nil || worker == nil {
Expand Down Expand Up @@ -294,7 +297,6 @@ func (s *Scheduler) StartProcessingRequests() {
}
}

s.addContainerCostPerMs(request)
log.Error().Str("container_id", request.ContainerId).Err(err).Msg("unable to add worker")
s.addRequestToBacklog(request)
}()
Expand Down
2 changes: 2 additions & 0 deletions pkg/worker/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ func (s *Worker) spawn(request *types.ContainerRequest, spec *specs.Spec, output
}

// Log metrics

log.Info().Str("container_id", request.ContainerId).Str("cost_per_ms", fmt.Sprintf("%f", request.CostPerMs)).Msg("container cost per ms")
go s.workerMetrics.EmitContainerUsage(ctx, request)
go s.eventRepo.PushContainerStartedEvent(containerId, s.workerId, request)
defer func() { go s.eventRepo.PushContainerStoppedEvent(containerId, s.workerId, request) }()
Expand Down

0 comments on commit dfddb44

Please sign in to comment.