-
Notifications
You must be signed in to change notification settings - Fork 4
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
RM-42 job config schema too complex #231
Conversation
Any advice on this @ryantimjohn? I'm not too happy with it so far. All the extra params needing to be passed around plus the type-checking info makes it more convoluted than I'd like. Also it's still "too complex". There's some logic around the |
self.arg_parser.add_argument(false_arg_arg_name, **false_arg_kwargs) | ||
self._configure_from_boolean(value, key, required_keys, formatted_key_name, kwargs) | ||
if value.get('default') is True: | ||
arg_name = "--no_" + formatted_key_name |
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.
This branch isn't unit tested
I was thinking about this with my own over complex function and read somewhere online "if you're passing around too many parameters you might have an object sitting in there." I think I'm going to work a parameters object into mine, don't know if that's helpful here. |
As for extracting the |
58f796c
to
e46b9a5
Compare
Odd, getting a bunch of these errors, I don't think it's related to my changes but it's possible
|
Very bizarre, wonder if one of the tokens died in the background or something but... that seems extremely unlikely. |
@@ -60,6 +60,7 @@ def configure_from_properties(self, | |||
properties: JsonSchema, | |||
required_keys: Iterable[str], | |||
prefix: str = '') -> None: | |||
self.required_keys = required_keys |
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.
Really not a huge fan of setting self vars outside of __init__
, but it does make the rest of the code easier. To move it to __init__
would require making new overloaded init functions that accept more params, which I'm not sure I want to do
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.
that makes sense. Does adding a setter
method to the class make sense? Then, at least, when assessing the class's code, you'd know what potential attributes the class had?
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.
Could you explain a bit more? I'm not really sure what you mean
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.
Sorry, please ignore last comment, wrote very quickly.
Basically, I wonder if it just makes sense to break out the piece where you assign the required_keys
attribute into a separate set_required_keys
method and then just call that method in the configure_from_properties
method. Not sure it's worth the trouble.
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.
Ah, sure, is the goal simply to make it more explicit?
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.
yep!
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.
Changes look good! A lot easier to read now.
No description provided.