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

add -S, --setattr and -c, --config-path options directly to flux start #6452

Merged
merged 9 commits into from
Nov 22, 2024

Conversation

grondo
Copy link
Contributor

@grondo grondo commented Nov 21, 2024

I kept getting annoyed that the common broker options for configuration path and setting attributes have to be passed through flux start's -o, --broker-opts option. flux start is used solely to start brokers, so why can't it just support these common options directly? So, submitted for your consideration is a PR that adds -S, --setattr and -c, --config-path options directly to flux start. If used, these options are just passed along to the broker(s) being started.

WIP because there's no tests or documentation updates in case there's some reason I'm not thinking of that this was a bad idea.

@garlick
Copy link
Member

garlick commented Nov 21, 2024

Sounds like a great idea to me.

@grondo grondo changed the title WIP: add -S, --setattr and -c, --config-path options directly to flux start add -S, --setattr and -c, --config-path options directly to flux start Nov 21, 2024
@grondo
Copy link
Contributor Author

grondo commented Nov 21, 2024

Converted most of the testsuite to use flux start -S/-c directly instead of -o,-S or -o,-c etc. Removed WIP.
(We'll see if this passes CI)

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! Great cleanup!

Problem: The setup of common broker arguments is duplicated between
`exec_broker()` and `client_create()`, which could result in
inadvertent drift between the two methods for executing brokers.

Add a new `add_args_common()` function and put the addition of common
arguments there.
Problem: client_create() uses asprintf() to build a broker option
when add_argzf() already exists for that purpose.

Switch to add_argzf().
Problem: flux-start.c has a few lines that do not conform to modern
project coding style.

Break some long parameter lists into one per line, remove extraneous
whitespace in a couple places, and shorten a few lines that were
80 characters or longer.
Problem: It would be useful to have a way to prepend a string to
every argument added to the broker cmdline with add_args_list(),
but this functionality does not exist.

Add a prepend argument to add_args_list(). Update current callers to
prepend an empty string.
Problem: Setting broker attributes from `flux start` is unnecessarily
complicated by requiring the broker `--setattr` option to be passed
via `-o, --broker-opts=`. But this indirection seems senseless because
the only thing `flux start` does is start brokers.

Add a `-S, --setattr=` option to `flux start` that just passes the same
option down to the broker.
Problem: To specify the broker config path on the command line of
`flux start`, the option must be passed via `-o, --broker-opts`,
which is slightly inconvenient.

Add a `-c, --config-path` option to `flux start` which just passes
the same along to the broker.
Problem: add_argzf() truncates arguments at 1023 characters.

Use vasnprintf() to dynamically allocate space for arguments to
avoid the truncation.
Problem: The `-S, --setattr` and `-c, --config-path` options are
not documented in flux-start(1).

Document them.
Problem: Throughout the testsuite `-o-Sattr=val` and `-o,-cPATH`
are used to pass broker attributes and config-path to Flux brokers,
but this level of indirection is no longer necessary since flux-start
supports `-S, --setattr` and `-c, --config-path` options.

Update the testsuite to use `flux start` `-S, --setattr` and `-c,
--config-path` options where it makes sense.
@grondo grondo force-pushed the flux-start-newargs branch from 8e87c50 to 89c2016 Compare November 21, 2024 23:46
@grondo
Copy link
Contributor Author

grondo commented Nov 21, 2024

Thanks, coverage is low just because there's a lot of error conditions we can't hit in test. I'll set MWP.

@mergify mergify bot merged commit 607c57e into flux-framework:master Nov 22, 2024
33 of 34 checks passed
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 78.04878% with 9 lines in your changes missing coverage. Please review.

Project coverage is 83.63%. Comparing base (01d3650) to head (89c2016).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
src/cmd/flux-start.c 78.04% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6452      +/-   ##
==========================================
+ Coverage   83.61%   83.63%   +0.01%     
==========================================
  Files         523      523              
  Lines       87533    87538       +5     
==========================================
+ Hits        73192    73210      +18     
+ Misses      14341    14328      -13     
Files with missing lines Coverage Δ
src/cmd/flux-start.c 83.94% <78.04%> (-0.38%) ⬇️

... and 15 files with indirect coverage changes

---- 🚨 Try these New Features:

@grondo grondo deleted the flux-start-newargs branch November 22, 2024 22:04
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