Skip to content

Commit a1a9c2b

Browse files
Ly Caoachals
authored andcommitted
fixed test to use go_feature_server flag in test + added option to 2 go server implementations + fix parsedKind
Signed-off-by: Felix Wang <wangfelix98@gmail.com> Signed-off-by: Achal Shah <achals@gmail.com>
1 parent 909af37 commit a1a9c2b

9 files changed

Lines changed: 269 additions & 201 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ test-python-universal:
7777
test-python-go-server:
7878
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --goserver sdk/python/tests
7979

80+
test-python-go-server-lifecycle:
81+
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --goserverlifecycle sdk/python/tests
82+
8083
format-python:
8184
# Sort
8285
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/

go/internal/feast/featurestore.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ func (fs *FeatureStore) DestructOnlineStore() {
224224

225225
func (fs *FeatureStore) parseKind(kind interface{}) (*ParsedKind, error) {
226226
if featureList, ok := kind.(*serving.GetOnlineFeaturesRequest_Features); ok {
227-
return &ParsedKind{features: featureList.Features.GetVal()}, nil
227+
return &ParsedKind{features: featureList.Features.GetVal(), featureService: nil}, nil
228228
}
229229
if featureServiceRequest, ok := kind.(*serving.GetOnlineFeaturesRequest_FeatureService); ok {
230230
featureService, err := fs.registry.getFeatureService(fs.config.Project, featureServiceRequest.FeatureService)
231231
if err != nil {
232232
return nil, err
233233
}
234-
return &ParsedKind{featureService: featureService}, nil
234+
return &ParsedKind{features: nil, featureService: featureService}, nil
235235
}
236236
return nil, errors.New("cannot parse kind from GetOnlineFeaturesRequest")
237237
}
@@ -245,10 +245,7 @@ func (fs *FeatureStore) parseKind(kind interface{}) (*ParsedKind, error) {
245245

246246
func (fs *FeatureStore) getFeatures(parsedKind *ParsedKind, allowCache bool) ([]string, error) {
247247

248-
if parsedKind.features == nil {
249-
if parsedKind.featureService == nil {
250-
return nil, errors.New("Cannot parse FeatureService from request")
251-
}
248+
if parsedKind.featureService != nil {
252249

253250
var featureViewName string
254251
features := make([]string, 0)
@@ -275,7 +272,7 @@ func (fs *FeatureStore) getFeatures(parsedKind *ParsedKind, allowCache bool) ([]
275272
retrieving all feature views. Similar argument to FeatureService applies.
276273
277274
*/
278-
func (fs *FeatureStore) getFeatureViewsToUse(parsedKind interface{}, allowCache, hideDummyEntity bool) ([]*FeatureView, []*RequestFeatureView, []*OnDemandFeatureView, error) {
275+
func (fs *FeatureStore) getFeatureViewsToUse(parsedKind *ParsedKind, allowCache, hideDummyEntity bool) ([]*FeatureView, []*RequestFeatureView, []*OnDemandFeatureView, error) {
279276

280277
fvs := make(map[string]*FeatureView)
281278
requestFvs := make(map[string]*RequestFeatureView)
@@ -296,7 +293,8 @@ func (fs *FeatureStore) getFeatureViewsToUse(parsedKind interface{}, allowCache,
296293
odFvs[onDemandFeatureView.base.name] = onDemandFeatureView
297294
}
298295

299-
if featureService, ok := parsedKind.(*FeatureService); ok {
296+
if parsedKind.featureService != nil {
297+
featureService := parsedKind.featureService
300298

301299
fvsToUse := make([]*FeatureView, 0)
302300
requestFvsToUse := make([]*RequestFeatureView, 0)

sdk/python/feast/flags.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME = "aws_lambda_feature_server"
44
FLAG_DIRECT_INGEST_TO_ONLINE_STORE = "direct_ingest_to_online_store"
55
FLAG_GO_FEATURE_SERVER = "go_feature_server"
6+
FLAG_GO_FEATURE_SERVER_USE_THREAD = "go_feature_server_use_thread"
67
ENV_FLAG_IS_TEST = "IS_TEST"
78

89
FLAG_NAMES = {
@@ -11,4 +12,5 @@
1112
FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME,
1213
FLAG_DIRECT_INGEST_TO_ONLINE_STORE,
1314
FLAG_GO_FEATURE_SERVER,
15+
FLAG_GO_FEATURE_SERVER_USE_THREAD
1416
}

sdk/python/feast/flags_helper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def _env_flag_enabled(name: str) -> bool:
99

1010

1111
def feature_flag_enabled(repo_config: RepoConfig, flag_name: str) -> bool:
12-
if is_test():
12+
if is_test() and not (flag_name == flags.FLAG_GO_FEATURE_SERVER or flag_name == flags.FLAG_GO_FEATURE_SERVER_USE_THREAD):
1313
return True
1414
return (
1515
_alpha_feature_flag_enabled(repo_config)
@@ -45,3 +45,6 @@ def enable_direct_ingestion_to_online_store(repo_config: RepoConfig) -> bool:
4545

4646
def enable_go_feature_server(repo_config: RepoConfig) -> bool:
4747
return feature_flag_enabled(repo_config, flags.FLAG_GO_FEATURE_SERVER)
48+
49+
def enable_go_feature_server_use_thread(repo_config: RepoConfig) -> bool:
50+
return feature_flag_enabled(repo_config, flags.FLAG_GO_FEATURE_SERVER_USE_THREAD)

0 commit comments

Comments
 (0)