-
Notifications
You must be signed in to change notification settings - Fork 996
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
Dont write defaults to config #1188
Conversation
Signed-off-by: mike0sv <mike0sv@gmail.com>
Signed-off-by: mike0sv <mike0sv@gmail.com>
# Conflicts: # sdk/python/feast/client.py # sdk/python/feast/config.py # sdk/python/feast/constants.py
defaults extraction Signed-off-by: mike0sv <mike0sv@gmail.com>
Signed-off-by: mike0sv <mike0sv@gmail.com>
Signed-off-by: mike0sv <mike0sv@gmail.com>
Hi @mike0sv. Thanks for your PR. I'm waiting for a feast-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
**fallback, | ||
) | ||
|
||
def get(self, option, default=_UNSET): |
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.
@mike0sv How are you planning for people to use this default
argument? Do you want them to define defaults throughout the code base, for example .get(key, default="foo")
?
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.
Yes, his option can be used if there is no value even in .constants
. Also this allows to get arbitrary options from config (it's a side effect, so I don't know if cases where this is needed exist).
For now, if you try to get an option, which is declared as Optional
in .constants
(more precisely, that has None
as default value), you'll get an error (because of the filtering in the defaults
method)
@@ -29,6 +29,7 @@ | |||
from feast.constants import ConfigOptions as opt | |||
|
|||
_logger = logging.getLogger(__name__) | |||
_UNSET = object() |
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.
How is the object()
type used here? Is there any reason why we can't use default=None
?
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.
It is a signleton, just like configparser._UNSET
. If you use None
, either you can't use None
as default value, or you'll get None
even if you don't want default value and do expect an exception
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mike0sv, woop The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
/kind housekeeping |
/lgtm |
You need to add a release note |
What this PR does / why we need it:
Stops default config values from being written to config file (~/.feast/config) and adds a possibility to provide default value when extracting configuration option. The discussion about this change is in #1172
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: