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

Don't wrap warrning messages when stderr is not a TTY #12285

Merged
merged 1 commit into from
Nov 11, 2020

Conversation

ashb
Copy link
Member

@ashb ashb commented Nov 11, 2020

If stderr is not a TTY, rich was hard-wrapping warning messages at 80 characters:

/home/ash/code/airflow/airflow/airflow/configuration.py:328 DeprecationWarning:
The remote_logging option in [core] has been moved to the remote_logging option
in [logging] - the old setting has been used, but please update your config.

After

/home/ash/code/airflow/airflow/airflow/configuration.py:328 DeprecationWarning: The remote_logging option in [core] has been moved to the remote_logging option in [logging] - the old setting has been used, but please update your config.

rich.print() doesn't take a soft_wrap option, so I had to create a rich.console.Console object -- and it seems best to cache those. (This is basically what rich.print() does internally).


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

If stderr is not a TTY, rich was hard-wrapping warning messages at 80
characters:

```
/home/ash/code/airflow/airflow/airflow/configuration.py:328 DeprecationWarning:
The remote_logging option in [core] has been moved to the remote_logging option
in [logging] - the old setting has been used, but please update your config.
```

After

```
/home/ash/code/airflow/airflow/airflow/configuration.py:328 DeprecationWarning: The remote_logging option in [core] has been moved to the remote_logging option in [logging] - the old setting has been used, but please update your config.
```

`rich.print()` doesn't take a `soft_wrap` option, so I had to create a
`rich.console.Console` object -- and it seems best to cache those.
@ashb ashb added this to the Airflow 2.0.0-beta3 milestone Nov 11, 2020
@ashb ashb requested review from kaxil and turbaszek November 11, 2020 15:35
@github-actions
Copy link

The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 11, 2020
@ashb ashb merged commit 0d51a12 into apache:master Nov 11, 2020
@ashb ashb deleted the no-wrap-warnings-non-tty-output branch November 12, 2020 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants