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

Redirect prints from Spack to log file #257

Merged

Conversation

dapomeroy
Copy link
Collaborator

Redirects prints from Spack to a log file to provide a cleaner command line experience for users. Logger wraps everything within the run_pipeline() method in workspace.py, which currently covers workspace setup, analyze, and mirror commands. All of stdout gets redirected into the logfile, unless inside a logger.force_echo() block. Added force_echo() blocks to all errors / tty.die within spack.py to ensure errors get printed to stdout.

@dapomeroy dapomeroy force-pushed the redirect_prints branch 3 times, most recently from 2da9034 to 0dadf8b Compare August 31, 2023 19:38
@dapomeroy dapomeroy force-pushed the redirect_prints branch 10 times, most recently from 1c47f12 to 46b7075 Compare September 14, 2023 16:52
Copy link
Collaborator

@douglasjacobsen douglasjacobsen 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 this. Overall it looks good, I have a few things that should be changed in the PR, and one bug that I ran into while testing it.

It seems if you use debug mode, most of the debug output is just lost entirely and not written to any of the log files.

Verbose appears to work correctly, but debug doesn't for some reason.

lib/ramble/ramble/test/cmd/workspace.py Outdated Show resolved Hide resolved
lib/ramble/ramble/test/end_to_end/explicit_zips.py Outdated Show resolved Hide resolved
lib/ramble/ramble/test/end_to_end/phase_selection.py Outdated Show resolved Hide resolved
lib/ramble/ramble/test/end_to_end/wrfv4_dry_run.py Outdated Show resolved Hide resolved
lib/ramble/ramble/workspace/workspace.py Outdated Show resolved Hide resolved
@dapomeroy
Copy link
Collaborator Author

All fixed up. Just needed to pass the global debug setting to the logger.

Copy link
Collaborator

@douglasjacobsen douglasjacobsen left a comment

Choose a reason for hiding this comment

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

Thanks! Debug works now. A few more nits about the log file stuff though.

lib/ramble/ramble/application.py Outdated Show resolved Hide resolved
lib/ramble/ramble/application.py Outdated Show resolved Hide resolved
lib/ramble/ramble/workspace/workspace.py Outdated Show resolved Hide resolved
Redirects prints from Spack to a log file
to provide a better experience to users
@douglasjacobsen douglasjacobsen merged commit 2f6cac7 into GoogleCloudPlatform:develop Sep 15, 2023
5 checks passed
@dapomeroy dapomeroy deleted the redirect_prints branch April 12, 2024 21:29
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.

2 participants