Skip to content

Commit

Permalink
amend! creating copy of ExecutorInfo for each mesos offer so there is…
Browse files Browse the repository at this point in the history
… not race condition

creating copy of ExecutorInfo for each mesos offer so there is not race condition
  • Loading branch information
Michal Tichák authored and knopers8 committed Sep 19, 2024
1 parent 8989162 commit 09ec975
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/task/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ func makeTaskForMesosResources(

newTaskId := taskPtr.GetTaskId()

executor := state.CopyExecutor()
executor := state.CopyExecutorInfo()
executor.ExecutorID.Value = taskPtr.GetExecutorId()
envIdS := envId.String()

Expand Down
16 changes: 3 additions & 13 deletions core/task/schedulerstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/AliceO2Group/Control/common/logger/infologger"
"github.com/AliceO2Group/Control/core/controlcommands"
"github.com/AliceO2Group/Control/core/task/schedutil"
"github.com/gogo/protobuf/proto"
"github.com/looplab/fsm"
mesos "github.com/mesos/mesos-go/api/v1/lib"
"github.com/mesos/mesos-go/api/v1/lib/backoff"
Expand Down Expand Up @@ -214,17 +215,6 @@ func (state *schedulerState) Start(ctx context.Context) {
}()
}

func (state *schedulerState) CopyExecutor() *mesos.ExecutorInfo {
executorInfoCopy := &mesos.ExecutorInfo{}

marshaled, err := state.executor.Marshal()
if err != nil {
return nil
}

err = executorInfoCopy.Unmarshal(marshaled)
if err != nil {
return nil
}
return executorInfoCopy
func (state *schedulerState) CopyExecutorInfo() *mesos.ExecutorInfo {
return proto.Clone(state.executor).(*mesos.ExecutorInfo)
}

0 comments on commit 09ec975

Please sign in to comment.