Don't strip ANSI from stdout (fixes #2365)#2366
Merged
basfroman merged 4 commits intoopentensor:stagingfrom Nov 22, 2024
Merged
Don't strip ANSI from stdout (fixes #2365)#2366basfroman merged 4 commits intoopentensor:stagingfrom
basfroman merged 4 commits intoopentensor:stagingfrom
Conversation
- Until now ANSI was stripped from stdout if bittensor was not running within a TTY (like in PM2) - This caused colored output to be broken under PM2 (and other process managers which do not give a TTY do bittensor/python - Bittensor posseses its own file logger, which makes this behavior unnecessary and unwanted. - This patch disables that behavior.
Contributor
Author
|
I found out that using Maybe this should be user-definable by some config parameter? |
Only without output wrapping does terminal output under PM2 behave correctly.
Contributor
|
Sorry, what is PM2? |
Contributor
|
No response from OP after two weeks. Closing. Can be re-opened if still needed. |
basfroman
approved these changes
Nov 22, 2024
Collaborator
basfroman
left a comment
There was a problem hiding this comment.
I tested this. Works well for me.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Where ANSI Stripping takes place in colorama: https://github.com/tartley/colorama/blob/136808718af8b9583cb2eed1756ed6972eda4975/colorama/ansitowin32.py#L102
Bittensor call to colorama which indirectly breaks colors in terminal output in PM2:
bittensor/bittensor/utils/btlogging/format.py
Line 29 in 5edcee4
Fix for issue #2365