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

Remove feature specs being able to declare their serving or warehouse stores #159

Merged
merged 17 commits into from
May 9, 2019
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
4 changes: 4 additions & 0 deletions charts/feast/templates/serving-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
value: "{{ printf "%s.%s.svc.cluster.local" (include "feast.core.name" .) .Release.Namespace }}"
- name: FEAST_CORE_GRPC_PORT
value: "{{ .Values.core.service.grpc.port }}"
- name: STORE_SERVING_TYPE
value: {{ .Values.store.serving.type }}
- name: STORE_SERVING_OPTIONS
value: {{ .Values.store.serving.options | toJson}}
- name: FEAST_MAX_NB_THREAD
value: "{{ .Values.serving.config.maxNumberOfThread }}"
- name: FEAST_MAX_ENTITY_PER_BATCH
Expand Down
13 changes: 0 additions & 13 deletions cli/feast/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ Valid resources include:
- entity
- feature
- featureGroup
- storage

Examples:
- feast apply entity entity.yml
- feast apply storage storage1.yml storage2.yml
- feast apply feature *-feature.yml`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
Expand Down Expand Up @@ -90,8 +88,6 @@ func apply(ctx context.Context, coreCli core.CoreServiceClient, resource string,
return applyFeatureGroup(ctx, coreCli, yml)
case "entity":
return applyEntity(ctx, coreCli, yml)
case "storage":
return applyStorage(ctx, coreCli, yml)
default:
return "", fmt.Errorf("invalid resource %s: please choose one of [feature, featureGroup, entity, storage]", resource)
}
Expand Down Expand Up @@ -124,15 +120,6 @@ func applyEntity(ctx context.Context, coreCli core.CoreServiceClient, yml []byte
return es.GetName(), err
}

func applyStorage(ctx context.Context, coreCli core.CoreServiceClient, yml []byte) (string, error) {
ss, err := parse.YamlToStorageSpec(yml)
if err != nil {
return "", err
}
_, err = coreCli.ApplyStorage(ctx, ss)
return ss.GetId(), err
}

func isYaml(path string) bool {
ext := filepath.Ext(path)
if ext == ".yaml" || ext == ".yml" {
Expand Down
71 changes: 30 additions & 41 deletions cli/feast/cmd/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package cmd

import (
"context"
"testing"

"github.com/gojek/feast/cli/feast/cmd/mock"
"github.com/golang/mock/gomock"
"testing"

"github.com/gojek/feast/protos/generated/go/feast/core"
)
Expand All @@ -28,7 +29,6 @@ func Test_apply(t *testing.T) {
mockCore.EXPECT().ApplyEntity(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockCore.EXPECT().ApplyFeature(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockCore.EXPECT().ApplyFeatureGroup(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockCore.EXPECT().ApplyStorage(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()

type args struct {
ctx context.Context
Expand All @@ -45,89 +45,78 @@ func Test_apply(t *testing.T) {
{
name: "test apply invalid resource",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "invalidResource",
ctx: context.Background(),
coreCli: mockCore,
resource: "invalidResource",
fileLocation: "testdata/valid_entity.yaml",
},
want: "",
want: "",
wantErr: true,
},
{
name: "test apply entity",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
fileLocation: "testdata/valid_entity.yaml",
},
want: "myentity",
want: "myentity",
wantErr: false,
},
{
name: "test apply entity with non-existent file",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
fileLocation: "testdata/file_not_exists.yaml",
},
want: "",
want: "",
wantErr: true,
},
{
name: "test apply entity with no tag",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
fileLocation: "testdata/valid_entity_no_tag.yaml",
},
want: "myentity",
want: "myentity",
wantErr: false,
},
{
name: "test apply invalid syntax in entity yaml",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
ctx: context.Background(),
coreCli: mockCore,
resource: "entity",
fileLocation: "testdata/invalid_entity.yaml",
},
want: "",
want: "",
wantErr: true,
},
{
name: "test apply feature",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "feature",
ctx: context.Background(),
coreCli: mockCore,
resource: "feature",
fileLocation: "testdata/valid_feature.yaml",
},
want: "myentity.feature_bool_redis1",
want: "myentity.feature_bool_redis1",
wantErr: false,
},
{
name: "test apply feature group",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "featureGroup",
ctx: context.Background(),
coreCli: mockCore,
resource: "featureGroup",
fileLocation: "testdata/valid_feature_group.yaml",
},
want: "my_fg",
wantErr: false,
},
{
name: "test apply storage",
args: args{
ctx: context.Background(),
coreCli: mockCore,
resource: "storage",
fileLocation: "testdata/valid_storage.yaml",
},
want: "BIGQUERY1",
want: "my_fg",
wantErr: false,
},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/feast/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var getCmd = &cobra.Command{
Valid resources include:
- entity
- feature
- storage
- job

Examples:
Expand Down Expand Up @@ -81,6 +80,7 @@ func getEntity(ctx context.Context, cli core.UIServiceClient, id string) error {
return nil
}

// This function is deprecated, and may be removed in subsequent versions.
func getStorage(ctx context.Context, cli core.UIServiceClient, id string) error {
response, err := cli.GetStorage(ctx, &core.UIServiceTypes_GetStorageRequest{Id: id})
if err != nil {
Expand Down
32 changes: 16 additions & 16 deletions cli/feast/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var listCmd = &cobra.Command{
Valid resources include:
- entities
- features
- storage
- jobs

Examples:
Expand Down Expand Up @@ -73,12 +72,12 @@ func list(resource string) error {
return listFeatures(ctx, core.NewCoreServiceClient(coreConn))
case "entities":
return listEntities(ctx, core.NewCoreServiceClient(coreConn))
case "storage":
return listStorage(ctx, core.NewCoreServiceClient(coreConn))
case "jobs":
return listJobs(ctx, core.NewJobServiceClient(coreConn))
case "storage":
return listStorage(ctx, core.NewCoreServiceClient(coreConn))
default:
return fmt.Errorf("invalid resource %s: please choose one of [features, entities, storage, jobs]", resource)
return fmt.Errorf("invalid resource %s: please choose one of [features, storage, entities, jobs]", resource)
}
}

Expand Down Expand Up @@ -116,35 +115,36 @@ func listEntities(ctx context.Context, cli core.CoreServiceClient) error {
return nil
}

func listStorage(ctx context.Context, cli core.CoreServiceClient) error {
response, err := cli.ListStorage(ctx, &empty.Empty{})
func listJobs(ctx context.Context, cli core.JobServiceClient) error {
response, err := cli.ListJobs(ctx, &empty.Empty{})
if err != nil {
return err
}
w := new(tabwriter.Writer)
w.Init(os.Stdout, 0, 8, 2, ' ', 0)
fmt.Fprintf(w, "ID\tTYPE\n")
fmt.Fprintf(w, "--\t----\t\n")
for _, feat := range response.GetStorageSpecs() {
fmt.Fprintf(w, "JOB_ID\tTYPE\tRUNNER\tSTATUS\tAGE\n")
fmt.Fprintf(w, "------\t----\t------\t------\t---\n")
for _, job := range response.GetJobs() {
fmt.Fprintf(w, strings.Join(
[]string{feat.Id, feat.Type}, "\t")+"\n")
[]string{job.Id, job.Type, job.Runner, job.Status, timeutil.DurationUntilNowInHumanFormat(*job.Created)}, "\t")+"\n")
}
w.Flush()
return nil
}

func listJobs(ctx context.Context, cli core.JobServiceClient) error {
response, err := cli.ListJobs(ctx, &empty.Empty{})
// This function is deprecated, and may be removed in subsequent versions.
func listStorage(ctx context.Context, cli core.CoreServiceClient) error {
response, err := cli.ListStorage(ctx, &empty.Empty{})
if err != nil {
return err
}
w := new(tabwriter.Writer)
w.Init(os.Stdout, 0, 8, 2, ' ', 0)
fmt.Fprintf(w, "JOB_ID\tTYPE\tRUNNER\tSTATUS\tAGE\n")
fmt.Fprintf(w, "------\t----\t------\t------\t---\n")
for _, job := range response.GetJobs() {
fmt.Fprintf(w, "ID\tTYPE\n")
fmt.Fprintf(w, "--\t----\t\n")
for _, feat := range response.GetStorageSpecs() {
fmt.Fprintf(w, strings.Join(
[]string{job.Id, job.Type, job.Runner, job.Status, timeutil.DurationUntilNowInHumanFormat(*job.Created)}, "\t")+"\n")
[]string{feat.Id, feat.Type}, "\t")+"\n")
}
w.Flush()
return nil
Expand Down
Loading