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
5 changes: 4 additions & 1 deletion infra/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ services:

redis:
image: redis:5-alpine
ports:
- "6379:6379"

kafka:
image: confluentinc/cp-kafka:5.2.1
Expand All @@ -70,7 +72,8 @@ services:
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
ports:
- 9094:9092
- "9092:9092"
- "9094:9094"

depends_on:
- zookeeper
Expand Down
Empty file removed sdk/__init__.py
Empty file.
43 changes: 13 additions & 30 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import click
from feast import config as feast_config
from feast.client import Client
from feast.resource import ResourceFactory
from feast.feature_set import FeatureSet
import toml
import pkg_resources
Expand Down Expand Up @@ -147,17 +146,25 @@ def feature_set_list():
print(tabulate(table, headers=["NAME", "VERSION"], tablefmt="plain"))


@feature_set.command("create")
@click.argument("name")
def feature_set_create(name):
@feature_set.command("apply")
@click.option(
"--filename",
"-f",
help="Path to a feature set configuration file that will be applied",
type=click.Path(exists=True),
)
def feature_set_create(filename):
"""
Create a feature set
Create or update a feature set
"""

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.apply(FeatureSet(name=name))
feast_client.apply(feature_sets)


@feature_set.command("describe")
Expand Down Expand Up @@ -264,29 +271,5 @@ def ingest(name, version, filename, file_type):
feature_set.ingest_file(file_path=filename)


@cli.command()
@click.option(
"--filename",
"-f",
help="Path to the configuration file that will be applied",
type=click.Path(exists=True),
)
def apply(filename):
"""
Apply a configuration to a resource by filename or stdin
"""

resources = [
ResourceFactory.get_resource(res_dict["kind"]).from_dict(res_dict)
for res_dict in yaml_loader(filename)
]

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

feast_client.apply(resources)


if __name__ == "__main__":
cli()
2 changes: 0 additions & 2 deletions sdk/python/feast/feature_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,6 @@ def from_dict(cls, fs_dict):
Returns a FeatureSet object based on the feature set dict
"""

if ("kind" not in fs_dict) and (fs_dict["kind"].strip() != "feature_set"):
raise Exception(f"Resource kind is not a feature set {str(fs_dict)}")
feature_set_proto = json_format.ParseDict(
fs_dict, FeatureSetProto(), ignore_unknown_fields=True
)
Expand Down
7 changes: 2 additions & 5 deletions sdk/python/feast/loaders/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _get_yaml_contents(yml: str) -> str:
with open(yml, "r") as f:
yml_content = f.read()

elif isinstance(yml, str) and "kind" in yml.lower():
elif isinstance(yml, str):
yml_content = yml
else:
raise Exception(
Expand All @@ -73,7 +73,4 @@ def _yaml_to_dict(yaml_string):
Dictionary containing the same object
"""

yaml_dict = yaml.safe_load(yaml_string)
if not isinstance(yaml_dict, dict) or not "kind" in yaml_dict:
raise Exception(f"Could not detect YAML kind from resource: ${yaml_string}")
return yaml_dict
return yaml.safe_load(yaml_string)
10 changes: 0 additions & 10 deletions sdk/python/feast/resource.py

This file was deleted.