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

Improve intermediate status for Jobs #832

Merged
merged 1 commit into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Improvements

- Aggregate error messages from Pods on Job Read. (https://github.com/pulumi/pulumi-kubernetes/pull/831).
- Improve interactive status for Jobs. (https://github.com/pulumi/pulumi-kubernetes/pull/832).

## 1.2.0 (October 4, 2019)

Expand Down
19 changes: 15 additions & 4 deletions pkg/await/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package await

import (
"strings"
"time"

"github.com/golang/glog"
Expand Down Expand Up @@ -135,10 +136,7 @@ func (jia *jobInitAwaiter) Await() error {
return err
}
case messages := <-podAggregator.ResultChan():
for _, message := range messages {
jia.errors.Add(message)
jia.config.logMessage(message)
}
jia.processPodMessages(messages)
}
}
}
Expand Down Expand Up @@ -211,6 +209,19 @@ func (jia *jobInitAwaiter) processJobEvent(event watch.Event) error {
return nil
}

func (jia *jobInitAwaiter) processPodMessages(messages logging.Messages) {
for _, message := range messages {
jia.errors.Add(message)

// The unready status condition always occurs as a normal part of a Job running, so don't print
// this as a warning. If the Job fails to complete, this warning will be included in the subErrors.
if strings.Contains(message.S, "containers with unready status") {
continue
}
jia.config.logMessage(message)
}
}

func (jia *jobInitAwaiter) errorMessages() []string {
messages := make([]string, 0)
for _, message := range jia.errors.Messages {
Expand Down