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

skip "empty" lines of output in flux resource list with --skip-empty or --include #6460

Merged
merged 5 commits into from
Dec 3, 2024

Conversation

grondo
Copy link
Contributor

@grondo grondo commented Nov 22, 2024

We didn't really come to a resolution in issue #6275 - however, it is clear that this output is surprising and wrong:

$ flux resource list --include=corona171
     STATE QUEUE   NNODES NCORES NGPUS NODELIST
      free pdebug       1     48     8 corona171
 allocated pbatch       0      0     0 
 allocated pdebug       0      0     0 
 allocated pnvmeof      0      0     0 
      down pbatch       0      0     0 
      down pdebug       0      0     0 
      down pnvmeof      0      0     0 

This PR adds a --skip-empty option to flux resource list to skip all lines that represent empty resource sets, then makes this the default for -i, --include (which is probably the expected and least surprising behavior). So, instead of the above, we get:

$ src/cmd/flux resource list --include=corona171
     STATE QUEUE  NNODES NCORES NGPUS NODELIST
      free pdebug      1     48     8 corona171

There is also now a --no-skip-empty option which disables the option with --include.

Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM!

Problem: There is no way to skip lines of empty resource sets in
`flux resource list`.

Add a `--skip-empty` option to suppress empty lines.
Problem: When using `flux resource list --include=TARGETS`, a set
of empty resource sets are generated for all configured queues.
This is probably not desired behavior.

Take the simple approach for now and skip empty lines if `--include`
is used.

In order to preserve the current behavior, also add a hidden
`--no-skip-empty` option which prevents skipping empty lines.

Use `--no-skip-empty` where necessary in t2350-resource-list.t to
avoid breaking existing tests.
Problem: t2350-resource-list.t doesn't explicitly test that `flux
resource list` skips empty lines by default with `--include`, and that
`--skip-empty` skips empty lines without `--include`.

Add a couple explicit tests of this behavior.
Problem: The bash tab completions for `flux resource list` do not
include the `--[no-]skip-empty` flags.

Add them.
Problem: The `--[no-]skip-empty` `flux resource list` options are
undocumented.

Add them to the flux-resource(1) manual.
@grondo
Copy link
Contributor Author

grondo commented Dec 3, 2024

Thanks! Will set MWP

@mergify mergify bot merged commit d61eccb into flux-framework:master Dec 3, 2024
34 checks passed
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.62%. Comparing base (3acf1d8) to head (c2e7203).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6460      +/-   ##
==========================================
+ Coverage   83.60%   83.62%   +0.01%     
==========================================
  Files         523      523              
  Lines       87552    87558       +6     
==========================================
+ Hits        73201    73220      +19     
+ Misses      14351    14338      -13     
Files with missing lines Coverage Δ
src/cmd/flux-resource.py 95.04% <100.00%> (+0.06%) ⬆️

... and 8 files with indirect coverage changes

@grondo grondo deleted the issue#6275 branch December 4, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants