scripts: clean up restart-strategy and service help output#14303
Conversation
PR SummaryLow Risk Overview
Reviewed by Cursor Bugbot for commit c5eb3bc. Bugbot is set up for automated code reviews on this repo. Configure here. |
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware reviewed 4 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on matanl-starkware).
scripts/prod/update_config_and_restart_nodes.py line 140 at r1 (raw file):
"--service", type=service_type_converter, choices=list(Service),
It looks like choices isn't needed, since type is run on first, (service_type_converter) and after that we have if converted_value not in choices: to decide whether to throw an error, but since we are checking the converted value, the input will always be valid (if the input was invalid we would have thrown an error in the `type' check).
scripts/prod/update_config_and_restart_nodes_lib.py line 125 at r1 (raw file):
"--restart-strategy", type=restart_strategy_converter, choices=list(RestartStrategy),
It looks like choices isn't needed, since type is run on first, (service_type_converter) and after that we have if converted_value not in choices: to decide whether to throw an error, but since we are checking the converted value, the input will always be valid (if the input was invalid we would have thrown an error in the `type' check).
8b8ce98 to
cf1868d
Compare
|
Addressed: removed the redundant |
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware reviewed 3 files and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on matanl-starkware).
cf1868d to
c0243c5
Compare
773b823 to
85f43e8
Compare
c0243c5 to
603bda9
Compare
85f43e8 to
85fcb3f
Compare
603bda9 to
3eda69b
Compare
85fcb3f to
3223758
Compare
3eda69b to
c3e2607
Compare
3223758 to
6ce3eed
Compare
c3e2607 to
e00fb67
Compare
9b72c31 to
8f348f3
Compare
666fb9b to
a31324f
Compare
8f348f3 to
94d2f12
Compare
94d2f12 to
a769e94
Compare
438f50f to
38add1d
Compare
a769e94 to
179d2e9
Compare
38add1d to
5cb9f2b
Compare
179d2e9 to
852f831
Compare
argparse rendered enum choices via str(), so --restart-strategy and --service
showed '{RestartStrategy.ALL_AT_ONCE,...}' / '{Service.Core,...}' rather than the
tokens users type. Add __str__ to both enums returning the accepted token
(value / name), give the args a metavar plus a help line listing the options,
and add a concise help formatter so options render as '-j, --service SERVICE'
instead of repeating the metavar. Also fix restart_strategy_converter to catch
ValueError (Enum value lookup raises ValueError, not KeyError) so invalid input
gets the informative error instead of argparse's generic fallback.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5cb9f2b to
c5eb3bc
Compare
|
@ron-starkware — next one 🙏 #14302 merged, so this rebased onto |
|
@ron-starkware friendly follow-up 🙏 — this one's been ready overnight (CI green, no open threads); it just needs a fresh LGTM on the rebased revision so I can merge it and continue the stack (#14304–#14306 next). Thanks! |
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on matanl-starkware).

argparse rendered enum choices via str(), so --restart-strategy and --service
showed '{RestartStrategy.ALL_AT_ONCE,...}' / '{Service.Core,...}' rather than the
tokens users type. Add str to both enums returning the accepted token
(value / name), give the args a metavar plus a help line listing the options,
and add a concise help formatter so options render as '-j, --service SERVICE'
instead of repeating the metavar. Also fix restart_strategy_converter to catch
ValueError (Enum value lookup raises ValueError, not KeyError) so invalid input
gets the informative error instead of argparse's generic fallback.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com