Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dataflow): Do not skip events to remove old pipeline versions #5469

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions scheduler/pkg/store/pipeline/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,19 @@ func (ps *PipelineStore) terminateOldUnterminatedPipelinesIfNeeded(pipeline *Pip
func (ps *PipelineStore) SetPipelineState(name string, versionNumber uint32, uid string, status PipelineStatus, reason string, source string) error {
logger := ps.logger.WithField("func", "SetPipelineState")
logger.Debugf("Attempt to set state on pipeline %s:%d status:%s", name, versionNumber, status.String())
evts, err := ps.setPipelineStateImpl(name, versionNumber, uid, status, reason)
evts, err := ps.setPipelineStateImpl(name, versionNumber, uid, status, reason, source)
if err != nil {
return err
}
if ps.eventHub != nil {
for _, evt := range evts {
evt.Source = source
ps.eventHub.PublishPipelineEvent(setStatusPipelineEventSource, *evt)
}
}
return nil
}

func (ps *PipelineStore) setPipelineStateImpl(name string, versionNumber uint32, uid string, status PipelineStatus, reason string) ([]*coordinator.PipelineEventMsg, error) {
func (ps *PipelineStore) setPipelineStateImpl(name string, versionNumber uint32, uid string, status PipelineStatus, reason, source string) ([]*coordinator.PipelineEventMsg, error) {
var evts []*coordinator.PipelineEventMsg
ps.mu.Lock()
defer ps.mu.Unlock()
Expand All @@ -367,8 +366,12 @@ func (ps *PipelineStore) setPipelineStateImpl(name string, versionNumber uint32,
PipelineName: pipelineVersion.Name,
PipelineVersion: pipelineVersion.Version,
UID: pipelineVersion.UID,
Source: source,
})
if status == PipelineReady {
// note that we are not setting the source for these events as we do not want to discard them in the chainer service
// i.e in handlePipelineEvent we want to process the termination events even though they are triggered by the chainer
// to set the status of the new version of the pipeline to ready
evts = append(evts, ps.terminateOldUnterminatedPipelinesIfNeeded(pipeline)...)
}
if !pipeline.Deleted && ps.db != nil {
Expand Down