-
Notifications
You must be signed in to change notification settings - Fork 74
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
Control astro dev
Output with --verbosity
Flag
#1770
Conversation
dd00790
to
bd1590d
Compare
bd1590d
to
4896922
Compare
b295a68
to
6fa7960
Compare
// Get project containers | ||
psInfo, err := d.composeService.Ps(context.Background(), d.projectName, api.PsOptions{ | ||
All: true, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, composeCreateErrMsg) | ||
} | ||
if len(psInfo) > 0 { | ||
// Ensure project is not already running | ||
for i := range psInfo { | ||
if checkServiceState(psInfo[i].State, dockerStateUp) { | ||
return errors.New("cannot start, project already running") | ||
} | ||
} | ||
} | ||
|
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.
It doesn't seem necessary to throw an error if the project is already started. Let's just make sure the image is updated and started, then re-print the status info.
astro dev
Output with --verbosity
Flag
astro dev
Output with --verbosity
Flagastro dev
Output with --verbosity
Flag
ca69f47
to
9e815ff
Compare
9e815ff
to
0250f96
Compare
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.
Very nice UX improvement! Approving ahead of some small comments.
airflow/docker.go
Outdated
@@ -279,6 +291,8 @@ func (d *DockerCompose) Start(imageName, settingsFile, composeFile, buildSecretS | |||
return err | |||
} | |||
|
|||
spinner.StopWithCheckmark(s, "Project has been started") |
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.
Happy to defer to others with more technical prose expertise but "has been" feels a bit redundant to me, would have expected just "Project started", and similarly for others below. I'd call this a nitpick but it becomes a prominent part of the CLI output now we're hiding so much low-level cruft.
airflow/docker_image.go
Outdated
} | ||
|
||
func (d *DockerImage) Pytest(pytestFile, airflowHome, envFile, testHomeDirectory string, pytestArgs []string, htmlReport bool, buildConfig airflowTypes.ImageBuildConfig) (string, error) { | ||
// Determine if we should output to terminal or buffer. | ||
output := logger.GetLevel() >= logrus.DebugLevel |
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.
We could add logger.IsLevelEnabled
to pkg/logger
and just call that from the if statements?
|
||
registryAuthSuccessMsg = "\nSuccessfully authenticated to Astronomer" | ||
registryAuthSuccessMsg = "Successfully authenticated to Astronomer" |
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.
Thanks for cleaning up these confusing "\n...
lines!
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.
Thanks for these changes @schnie !! 🚀
pkg/logger/logger.go
Outdated
func IsLevelEnabled() bool { | ||
return GetLevel() >= logrus.DebugLevel | ||
} |
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.
@pritt20 what do you think about making the level
a parameter here, so we could use it elsewhere to check the level? Maybe we'd want to rename to IsLevelAbove()
or something. It just wasn't clear to me what this function name would be doing without a parameter passed to it. Or we could just name this function like IsAboveDebugLevel()
and leave as-is. Curious what you think.
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.
Thanks @schnie !
I think it makes sense to convert this function to be more generic by accepting level as parameter. This would make this function flexible and more reusable across board.
I've made the required changes now.
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.
Can we just pass it on to the logrus IsLevelEnabled
?
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.
Thanks for pointing out @jeremybeard ! I've made the above changes.
Co-authored-by: Pritesh Arora <[email protected]>
Description
This PR cleans up the output on the
astro dev start/stop/kill/restart
commands. Today these commands output a lot of information that is mostly meaningless or unhelpful, distracting from the experience. A new user whose just downloaded the CLI should be focused on getting something running in Airflow, not thinking about containers and docker, etc yet.In this PR, we've suppressed the Image Build and Compose output for standard usage without any additional flags. This provides a nice, clean output with information about what's happening, but not every single detail. We're re-using the spinner we introduced recently for the runtime initialization messaging.
If users are interested in the full output, we've moved it behind the
--verbosity (debug|trace)
flag. For example, if you are troubleshooting something deep in the stack for some reasonastro dev start --verbosity debug
will show the output, just as it did before this change.If the build phase encounters an error, which is probably a somewhat common occurrence in the wild, the
stdout
andstderr
streams will be printed out, along with the error message.🎟 Issue(s)
Related to https://github.com/astronomer/astro/issues/26133
🧪 Functional Testing
📸 Screenshots
Default experience
--verbosity debug|trace
experienceError on Build Default Experience
📋 Checklist
make test
before taking out of draftmake lint
before taking out of draft