Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.executor
executor := state.CopyExecutor()
executor.ExecutorID.Value = taskPtr.GetExecutorId()
envIdS := envId.String()

Expand Down
21 changes: 17 additions & 4 deletions core/task/schedulerstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func NewScheduler(taskman *Manager, fidStore store.Singleton, shutdown func()) (
viper.GetFloat64("executorMemory")),
viper.GetDuration("mesosJobRestartDelay"),
)

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -161,11 +160,10 @@ func NewScheduler(taskman *Manager, fidStore store.Singleton, shutdown func()) (
},
"leave_CONNECTED": func(_ context.Context, e *fsm.Event) {
log.Debug("leave_CONNECTED")

},
"before_NEW_ENVIRONMENT": func(_ context.Context, e *fsm.Event) {
log.Debug("before_NEW_ENVIRONMENT")
e.Async() //transition frozen until the corresponding fsm.Transition call
e.Async() // transition frozen until the corresponding fsm.Transition call
},
"enter_CONNECTED": func(_ context.Context, e *fsm.Event) {
log.Debug("enter_CONNECTED")
Expand Down Expand Up @@ -208,10 +206,25 @@ func (state *schedulerState) Start(ctx context.Context) {
if state.err != nil {
err = state.err
log.WithField("error", err.Error()).Debug("scheduler quit with error, main state machine GO_ERROR")
state.sm.Event(context.Background(), "GO_ERROR", err) //TODO: use error information in GO_ERROR
state.sm.Event(context.Background(), "GO_ERROR", err) // TODO: use error information in GO_ERROR
} else {
log.Debug("scheduler quit, no errors")
state.sm.Event(context.Background(), "EXIT")
}
}()
}

func (state *schedulerState) CopyExecutor() *mesos.ExecutorInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename to CopyExecutorInfo for clarity?

also, perhaps proto.Clone() might be faster than marshalling and unmarshalling?

Copy link
Collaborator Author

@justonedev1 justonedev1 Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I did not use Clone originally was, that it did not build, hence the stupid marshalling/unmarshalling. I got error

*mesos.ExecutorInfo does not implement protoreflect.ProtoMessage (missing method ProtoReflect)
but the object in defined in filename.pb.go

but now it works... ffs literally the same code I used earlier today. I wonder what I did differently before (I even copied the same code as before :D)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could have been that you imported a wrong lib, I saw in GoLand that you could pick three different libraries with proto.Clone

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe... truth is, that I let lsp handle adding dependencies...

executorInfoCopy := &mesos.ExecutorInfo{}

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

err = executorInfoCopy.Unmarshal(marshaled)
if err != nil {
return nil
}
return executorInfoCopy
}
Loading