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

Dont write defaults to config #1188

Merged
merged 8 commits into from
Nov 22, 2020

Conversation

mike0sv
Copy link
Contributor

@mike0sv mike0sv commented Nov 22, 2020

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?:

NONE

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>
Signed-off-by: mike0sv <mike0sv@gmail.com>
Signed-off-by: mike0sv <mike0sv@gmail.com>
@feast-ci-bot
Copy link
Collaborator

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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):
Copy link
Member

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")?

Copy link
Contributor Author

@mike0sv mike0sv Nov 22, 2020

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()
Copy link
Member

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?

Copy link
Contributor Author

@mike0sv mike0sv Nov 22, 2020

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

@feast-ci-bot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@woop
Copy link
Member

woop commented Nov 22, 2020

/ok-to-test

@woop
Copy link
Member

woop commented Nov 22, 2020

/kind housekeeping

@woop
Copy link
Member

woop commented Nov 22, 2020

/lgtm

@feast-ci-bot feast-ci-bot merged commit faa08fe into feast-dev:master Nov 22, 2020
@woop
Copy link
Member

woop commented Nov 22, 2020

You need to add a release note

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.

3 participants