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

Add --log-file argument and log test result details #54

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

KyleFromNVIDIA
Copy link
Contributor

@KyleFromNVIDIA KyleFromNVIDIA commented Feb 22, 2024

Add a --log-file argument for container-canary to write detailed logs, so that developers can see exactly how and why a test failed.

Signed-off-by: Kyle Edwards <[email protected]>
Signed-off-by: Kyle Edwards <[email protected]>
Signed-off-by: Kyle Edwards <[email protected]>
Signed-off-by: Kyle Edwards <[email protected]>
@jameslamb
Copy link
Member

I'd like to revive this, but I don't have write access here.

@KyleFromNVIDIA could you update this to latest main and add a PR description?

And @jacobtomlinson after that could you help us out with a review?

@KyleFromNVIDIA KyleFromNVIDIA requested a review from a team as a code owner May 21, 2024 20:40
Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

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

Thanks for the patience on the review here.

I'm keen to dig into the motivation here, particularly around logging to a file. I expect canary will be used mostly in CI, so I would want output to be logged to stdout where it can be captured by the CI runner rather than disappearing into a file.

If I understand correctly the goal here is to provide more verbose messages around failures. Why not use the existing console output to supply this information?

@@ -40,7 +40,7 @@ checks:
description: 🌏 Exposes an HTTP interface on port 8888
probe:
httpGet:
path: /
path: /hub/jovyan
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about the motivation here. This feels orthogonal to the rest of this PR.

It's my understanding that Kubeflow only expects a service on port 8888, not any particular path on that web server. You could equally run VSCode Server or some other application and expect it to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR has some bug fixes and tests too. One of the bugs was that it wasn't checking the status code when doing httpGet. I fixed that, but as a result this test started failing (I don't remember what the return code was). GETting a different path got a successful status code.

@@ -85,6 +90,7 @@ func imageArg(cmd *cobra.Command, args []string) error {
func init() {
rootCmd.AddCommand(validateCmd)
validateCmd.PersistentFlags().String("file", "", "Path or URL of a manifest to validate against.")
validateCmd.PersistentFlags().String("log-file", "", "File to print log output to.")
Copy link
Member

Choose a reason for hiding this comment

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

Why not use stdout? That gives more flexibility for redirection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe stdout is already consumed by the user-readable output. Writing to a separate log file allows us to get separate machine-readable output, and CI can always cat the file if we want the developer to see it (that's what I plan on doing).

@jacobtomlinson
Copy link
Member

jacobtomlinson commented May 22, 2024

@jameslamb I've added you to the codeowners team here. @KyleFromNVIDIA I was unable to add you as you're not a member of the @NVIDIA org, we probably need to figure out how to add you so that you can be added to the codeowners.

@KyleFromNVIDIA
Copy link
Contributor Author

I was unable to add you as you're not a member of the @NVIDIA org, we probably need to figure out how to add you so that you can be added to the codeowners.

I've fixed this, you can go ahead and add me.

@KyleFromNVIDIA
Copy link
Contributor Author

@jameslamb @jacobtomlinson Is there anything else left to address here?

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

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

I'm still not sold on the design here I'm afraid. Writing detailed information to a logfile feels unusual in the context of this tool.

A core goal of container canary is to fit in comfortably in the cloud tooling ecosystem and behave in ways that match the expectations of users of cloud-native tooling like Kubernetes and Docker.

Given that canary is a tool that is intended to be used primarily in CI or remote environments it's much more common to always write to stdout/stderr with a configurable level of verbosity. A large motivation for this is that we assume the environment is ephemeral and the filesystem is lost after the job completes, but the standard streams are captured by an external logging service.

Adding a flag to write to a log file, then adding a cat command feels like a long winded way to just bump up the verbosity with a flag.

If there is strong motivation to merge this as it is I'd love to see some examples of other tools that follow this pattern of writing a more verbose stream to a separate file on disk. Especially tools which we expect to be commonly used alongside canary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants