-
Notifications
You must be signed in to change notification settings - Fork 51
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 incorrect combination of lines in flux resource status
for expandable fields that differ past the minimum width
#6638
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks! I've set MWP. |
This pull request has been removed from the queue for the following reason: The pull request #6638 has been manually updated You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
Problem: The OutputFormat copy() method takes an except_fields list of fields to suppress in the copy, but this can leave prefix sentinels like `+:` and `?:` and extra whitespace in the result. Suppress extra text from skipped fields if it is all whitespace or whitespace plus a supperted sentinel prefix.
Problem: The expansion sentinels `+:` and `?+:` allow an output format field to expand to the maximum width in a given list of formatted items. However, when a single item is formatted, any minimum width, as specified in the format spec, will cause the result to be truncated. This stymies attempts to find identical lines when the lines are not filtered first. Add options to the get_format_prepended() and copy() methods to "nullify" the expansion sentinel by replacing the field without any width and precision specifiers, i.e. `+:{foo:<3.3}` becomes simply `{foo}`, which allows the fully rendered width of the field to appear in any formatted result.
Problem: The Deduplicator class combines lines that would result in the same result after applying a format string (with some fields possibly excluded). This doesn't work when the expansion sentinel `+:` is used, because the Deduplication comes before the expansion, so the final maximum field width is not known, and instead the minimm field width is used. This causes unlike lines that differ beyond the minimum width to be combined. Pass `nullify_expansion=True` when copying the input format so that the width is dropped from these fields and deduplication uses the full width for comparison. Fixes flux-framework#6625
Problem: There are no unit tests for OutputFormat.copy(). Add some tests to python/t0024-util.py.
Problem: There is no test that ensures `flux resource status` does not combine dissimilar drain reasons when the reason field has the expandable `+:` prefix sentinel. Add a test to t2354-resource-status.t for this purpose.
Problem: The "show truncation" format string suffix character (`+`) is effectively ignored when the "expandable field" sentinel (`+:`) is used because the field never will be truncaated. However, some format strings in `flux-resource.py` use these together, potentially causing confusion. Remove the `+` suffix on fields using `+:` in the builtin flux-resource format strings.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6638 +/- ##
==========================================
+ Coverage 83.87% 83.88% +0.01%
==========================================
Files 533 533
Lines 88372 88377 +5
==========================================
+ Hits 74122 74137 +15
+ Misses 14250 14240 -10
|
This PR fixes #6625. Expandable width fields (those with the
+:
or?+:
prefix sentinel) are passed to theDeduplicator
class before the final maximum width is known, so comparison only occurs up to the minimum width. This was causing drain reasons that differ past the 30 character minimum width to be incorrectly combined.The fix here strips the field widths from expandable fields in the
Deduplicator
so that the entire field is compared.