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 logging verbosity level flag to extract_ir.py #278

Merged

Conversation

boomanaiden154
Copy link
Collaborator

This commit adds a logging verbosity level flag to extract_ir.py and the appropriate plumbing/implementation in extract_ir_lib.py. This is primarily motivated by these errors coming up quite often in non-trivial builds (as it is fairly often there is some assembly or some flags don't get passed around somewhere) and not providing a very high signal to noise ratio, especially when used as a library against a bunch of projects at once.

I've implemented this as a custom flag rather than using absl's logging.get_verbosity and logging.set_verbosity as I think this approach is a bit more expressive for the purposes here, and it also avoids us needing to set global state which is nice within the project and especially for downstream users (although it's not a big switch to do so the other method). I'm open to switching over if others have different ideas.

@mtrofin
Copy link
Collaborator

mtrofin commented Jul 14, 2023

https://abseil.io/docs/python/guides/logging? has already a command line for verbosity (should be verbosity).

@boomanaiden154
Copy link
Collaborator Author

Updated to use the absl logging facilities rather than custom plumbing everywhere.

This commit adds a logging verbosity level flag to extract_ir.py and the
appropriate plumbing/implementation in extract_ir_lib.py. This is
primarily motivated by these errors coming up quite often in non-trivial
builds (as it is fairly often there is some assembly or some flags don't
get passed around somewhere) and not providing a very high signal to
noise ratio, especially when used as a library against a bunch of
projects at once.
- Don't change logging verbosity back to info to print the status
  message if the verbosity has been set lower.
- Log subprocess output directly rather than having subprocess write
  directly to STDOUT/STDERR.
Copy link
Collaborator

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

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

just some nits

compiler_opt/tools/extract_ir_lib.py Outdated Show resolved Hide resolved
compiler_opt/tools/extract_ir_lib.py Outdated Show resolved Hide resolved
- Switch to using subprocess.check_output
Copy link
Collaborator

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

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

please don't forget to change the commit message

@boomanaiden154 boomanaiden154 merged commit 45a45dd into google:main Jul 20, 2023
15 checks passed
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