-
Notifications
You must be signed in to change notification settings - Fork 356
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: properly interpret flag values #8326
Conversation
Both `--preemptible` and `--preemption-enabled` cast values with the built-in `bool`, which casts to True any possible value but "0". Even "false" and "False". This is almost certainly not what users expect. Using `string_to_bool`, "0" is still supported. But now all the strings that should evaluate to False do, too.
✅ Deploy Preview for determined-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -427,7 +427,7 @@ def parse(s: str) -> Tuple[str, str]: | |||
), | |||
Arg( | |||
"--preemptible", | |||
type=bool, | |||
type=string_to_bool, |
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.
why is this string_to_bool
and not BoolOptArg
?
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.
You're right.
Reasoning was that despite its name, BoolOptArg
args aren't really optional, and aren't appropriate when the system doesn't want defaults. But this is one of those cases where having defaults is appropriate. I'll fix.
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.
Well, maybe not. 2 reasons:
- (minor reason) Switching to
BoolOptArg
changes the interface from--preemptible=true|false
to--preemptible|--no-preemptible
, and this is more likely to have user impact. - (major reason) Each of these args is a part of an
ArgGroup
, which contains a list ofArgs
.BoolOptArgs
are notArgs
and do not look likeArgs
and at this point I think refactoringBoolOptArgs
or shimming an interface is not worth this PR. I could just make eachArgGroup
'schild_args
list contain a union ofArgs
andBoolOptArgs
, but this feels like asking for trouble in the future if I don't unify the interface. I'm not convinced that it's worth spending a lot of time ondeclarative_argparse
's lesser-used features because I'm not sure what the future ofdeclarative_argparse
will be.
Both
--preemptible
and--preemption-enabled
cast values with the built-inbool
, which casts to True any possible value but "0". Even "false" and "False". This is almost certainly not what users expect.Using
string_to_bool
, "0" is still supported. But now all the strings that should evaluate to False do, too.Description
Test Plan
ROI on testing this might not be high, but:
Deploy a cluster to GCP with
det deploy gcp up
with different values for--preemptible
and--preemption-enabled
.Commentary (optional)
Checklist
docs/release-notes/
.See Release Note for details.
Ticket