Skip to content

Commit

Permalink
fix: Do not patch empty progress. fixes #7184 (#7204)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Weibel <michael@helio.exchange>
  • Loading branch information
mweibel authored Nov 12, 2021
1 parent 34e5b54 commit 1453edc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type WorkflowExecutor struct {
errors []error

// current progress which is synced every `annotationPatchTickDuration` to the pods annotations.
progress string
progress wfv1.Progress

annotationPatchTickDuration time.Duration
readProgressFileTickDuration time.Duration
Expand Down Expand Up @@ -980,9 +980,11 @@ func (we *WorkflowExecutor) monitorProgress(ctx context.Context, progressFile st
log.WithError(ctx.Err()).Info("stopping progress monitor (context done)")
return
case <-annotationPatchTicker.C:
log.WithField("progress", we.progress).Infof("patching pod progress annotation")
if err := we.AddAnnotation(ctx, common.AnnotationKeyProgress, we.progress); err != nil {
log.WithField("progress", we.progress).WithError(err).Warn("failed to patch progress annotation")
if we.progress != "" {
log.WithField("progress", we.progress).Infof("patching pod progress annotation")
if err := we.AddAnnotation(ctx, common.AnnotationKeyProgress, string(we.progress)); err != nil {
log.WithField("progress", we.progress).WithError(err).Warn("failed to patch progress annotation")
}
}
case <-fileTicker.C:
data, err := ioutil.ReadFile(progressFile)
Expand All @@ -1002,7 +1004,7 @@ func (we *WorkflowExecutor) monitorProgress(ctx context.Context, progressFile st

if progress, ok := wfv1.ParseProgress(lastLine); ok {
log.WithField("progress", progress).Info()
we.progress = string(progress)
we.progress = progress
} else {
log.WithField("line", lastLine).Info("unable to parse progress")
}
Expand Down

0 comments on commit 1453edc

Please sign in to comment.