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
chore(example): Add watch timeout and print out workflow status message #4740
Conversation
examples/example-golang/main.go
Outdated
@@ -68,6 +68,10 @@ func main() { | |||
if !ok { | |||
continue | |||
} | |||
if wf.Status.Phase == wfv1.NodeFailed || wf.Status.Phase == wfv1.NodeError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't the block on line 75 also catch this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. I was debugging why the example has been running forever and turns out that the problem is something else. I have updated this PR to print out the detailed error message from the status and added the timeout to the watch to improve the usability of this example. Let me know what you think.
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
examples/example-golang/main.go
Outdated
@@ -70,6 +71,9 @@ func main() { | |||
} | |||
if !wf.Status.FinishedAt.IsZero() { | |||
fmt.Printf("Workflow %s %s at %v\n", wf.Name, wf.Status.Phase, wf.Status.FinishedAt) | |||
if wf.Status.Phase == wfv1.NodeFailed || wf.Status.Phase == wfv1.NodeError { | |||
fmt.Printf("Workflow %s failed due to: %s", wf.Name, wf.Status.Message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you just add the wf.Status.Message
to line 74?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure updated.
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
The workflow in the current example would only exit the loop when it reaches completion. It's better to exit loop immediately when the workflow has failed.
Signed-off-by: terrytangyuan terrytangyuan@gmail.com
Checklist: