Skip to content

Commit

Permalink
remove scheduler stop build and move container instance set back
Browse files Browse the repository at this point in the history
  • Loading branch information
dleviminzi committed Jan 10, 2025
1 parent ce9005b commit bbaf479
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
15 changes: 0 additions & 15 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,6 @@ func (s *Scheduler) Stop(stopArgs *types.StopContainerArgs) error {
return nil
}

func (s *Scheduler) StopBuild(containerId string) error {
_, err := s.eventBus.Send(&common.Event{
Type: common.EventType("stop-build" + "-" + containerId),
Args: map[string]any{"container_id": containerId},
LockAndDelete: false,
})
if err != nil {
log.Error().Err(err).Msg("failed to send stop build event")
return err
}

log.Info().Str("container_id", containerId).Msg("sent stop build event")
return nil
}

func (s *Scheduler) getControllers(request *types.ContainerRequest) ([]WorkerPoolController, error) {
controllers := []WorkerPoolController{}

Expand Down
7 changes: 7 additions & 0 deletions pkg/worker/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ func (s *Worker) deleteContainer(containerId string, err error) {
func (s *Worker) RunContainer(ctx context.Context, request *types.ContainerRequest) error {
containerId := request.ContainerId

s.containerInstances.Set(containerId, &ContainerInstance{
Id: containerId,
StubId: request.StubId,
LogBuffer: common.NewLogBuffer(),
Request: request,
})

bundlePath := filepath.Join(s.imageMountPath, request.ImageId)

// Set worker hostname
Expand Down
6 changes: 0 additions & 6 deletions pkg/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,6 @@ func (s *Worker) Run() error {
}})
go eventbus.ReceiveEvents(ctx)

s.containerInstances.Set(containerId, &ContainerInstance{
Id: containerId,
StubId: request.StubId,
LogBuffer: common.NewLogBuffer(),
Request: request,
})
err := s.RunContainer(ctx, request)
if err != nil {
log.Error().Str("container_id", containerId).Err(err).Msg("unable to run container")
Expand Down

0 comments on commit bbaf479

Please sign in to comment.