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

Fix broken stdstream handling for bytes and arbitrary os.PathLike objects; test harder. #3363

Merged
merged 8 commits into from
Apr 19, 2024

Conversation

benclifford
Copy link
Collaborator

Description

Prior to this PR, an arbitrary os.PathLike was rendered to monitoring using that PathLike's str method. What should be appearing in the monitoring database should be a string representation of the path. This is an issue in (rare in practice?) cases where __str__ and __fspath__ return different things. This PR changes rendering to use fspath rather than str.

os.PathLike objects can also render as bytes, not str. This PR decodes those bytes using .decode().

This PR adds tests for various valid data types going from app stdout/err parameters to the corresponding column in the monitoring database, including test cases that drove the above fixes.

Changed Behaviour

This will change how some stdout/stderr paths are rendered to the monitoring database, hopefully for the better.

Type of change

  • Bug fix

Copy link
Collaborator

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

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

Nicely done with the test!

@benclifford benclifford merged commit afa46b7 into master Apr 19, 2024
6 checks passed
@benclifford benclifford deleted the benc-test-stdstreams-vs-monitoring branch April 19, 2024 05:43
benclifford added a commit that referenced this pull request Apr 20, 2024
PR #3347 attempted to do case-based logging of all the different kinds
of stdout/err specification.

It failed to capture some of the cases involving os.PathLike, and so
after PR #3347, those cases would log an ERROR that the specification
was unknown. This new behavior is only a new ERROR logging message -
PR #3347 did not change other behaviour.

This PR also amends a rich test of stdout/err specification types
introduced in PR #3363 to check that no ERROR messages are logged during
these tests.
benclifford added a commit that referenced this pull request Apr 22, 2024
PR #3347 attempted to do case-based logging of all the different kinds
of stdout/err specification.

It failed to capture some of the cases involving os.PathLike, and so
after PR #3347, those cases would log an ERROR that the specification
was unknown. This new behavior is only a new ERROR logging message -
PR #3347 did not change other behaviour.

This PR also amends a rich test of stdout/err specification types
introduced in PR #3363 to check that no ERROR messages are logged during
these tests.
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