Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 13 additions & 42 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

import click
import pkg_resources
import toml
import yaml

from feast import config as feast_config
from feast.client import Client
from feast.config import Config
from feast.feature_set import FeatureSet
from feast.loaders.yaml import yaml_loader

Expand Down Expand Up @@ -64,14 +63,7 @@ def version(client_only: bool, **kwargs):
}

if not client_only:
feast_client = Client(
core_url=feast_config.get_config_property_or_fail(
"core_url", force_config=kwargs
),
serving_url=feast_config.get_config_property_or_fail(
"serving_url", force_config=kwargs
),
)
feast_client = Client(**kwargs)
feast_versions_dict.update(feast_client.version())

print(json.dumps(feast_versions_dict))
Expand All @@ -94,13 +86,8 @@ def config_list():
"""
List Feast properties for the currently active configuration
"""

try:
feast_config_string = toml.dumps(feast_config._get_or_create_config())
if not feast_config_string.strip():
print("Configuration has not been set")
else:
print(feast_config_string.replace('""', "").strip())
print(Config())
except Exception as e:
_logger.error("Error occurred when reading Feast configuration file")
_logger.exception(e)
Expand All @@ -115,7 +102,9 @@ def config_set(prop, value):
Set a Feast properties for the currently active configuration
"""
try:
feast_config.set_property(prop.strip(), value.strip())
conf = Config()
conf.set(option=prop.strip(), value=value.strip())
conf.save()
except Exception as e:
_logger.error("Error in reading config file")
_logger.exception(e)
Expand All @@ -135,9 +124,7 @@ def feature_set_list():
"""
List all feature sets
"""
feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client
feast_client = Client() # type: Client

table = []
for fs in feast_client.list_feature_sets():
Expand All @@ -161,11 +148,7 @@ def feature_set_create(filename):
"""

feature_sets = [FeatureSet.from_dict(fs_dict) for fs_dict in yaml_loader(filename)]

feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client

feast_client = Client() # type: Client
feast_client.apply(feature_sets)


Expand All @@ -176,10 +159,7 @@ def feature_set_describe(name: str, version: int):
"""
Describe a feature set
"""
feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client

feast_client = Client() # type: Client
fs = feast_client.get_feature_set(name=name, version=version)
if not fs:
print(
Expand All @@ -204,9 +184,7 @@ def project_create(name: str):
"""
Create a project
"""
feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client
feast_client = Client() # type: Client
feast_client.create_project(name)


Expand All @@ -216,9 +194,7 @@ def project_archive(name: str):
"""
Archive a project
"""
feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client
feast_client = Client() # type: Client
feast_client.archive_project(name)


Expand All @@ -227,9 +203,7 @@ def project_list():
"""
List all projects
"""
feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client
feast_client = Client() # type: Client

table = []
for project in feast_client.list_projects():
Expand Down Expand Up @@ -265,10 +239,7 @@ def ingest(name, version, filename, file_type):
Ingest feature data into a feature set
"""

feast_client = Client(
core_url=feast_config.get_config_property_or_fail("core_url")
) # type: Client

feast_client = Client() # type: Client
feature_set = feast_client.get_feature_set(name=name, version=version)
feature_set.ingest_file(file_path=filename)

Expand Down
Loading