Skip to content

Dont write defaults to config - #1188

Merged
feast-ci-bot merged 8 commits into
feast-dev:masterfrom
mike0sv:dont-write-defaults
Nov 22, 2020
Merged

Dont write defaults to config#1188
feast-ci-bot merged 8 commits into
feast-dev:masterfrom
mike0sv:dont-write-defaults

Conversation

@mike0sv

@mike0sv mike0sv commented Nov 22, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

Details

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

@mike0sv mike0sv Nov 22, 2020

Copy link
Copy Markdown
Contributor Author

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)

from feast.constants import ConfigOptions as opt

_logger = logging.getLogger(__name__)
_UNSET = object()

Copy link
Copy Markdown
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?

@mike0sv mike0sv Nov 22, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

Details 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

woop commented Nov 22, 2020

Copy link
Copy Markdown
Member

/ok-to-test

@woop

woop commented Nov 22, 2020

Copy link
Copy Markdown
Member

/kind housekeeping

@woop

woop commented Nov 22, 2020

Copy link
Copy Markdown
Member

/lgtm

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

woop commented Nov 22, 2020

Copy link
Copy Markdown
Member

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