Skip to content

Commit 7a2c4cd

Browse files
authored
fix: Explicitly translate errors when instantiating the go fs (#2842)
* fix: Explicitly translate errors when instantiating the go fs and convert bool params Signed-off-by: Achal Shah <[email protected]> * uncomment more Signed-off-by: Achal Shah <[email protected]>
1 parent 34c997d commit 7a2c4cd

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

go/embedded/online_features.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type OnlineFeatureService struct {
3232
fs *feast.FeatureStore
3333
grpcStopCh chan os.Signal
3434
httpStopCh chan os.Signal
35+
36+
err error
3537
}
3638

3739
type OnlineFeatureServiceConfig struct {
@@ -56,12 +58,16 @@ type LoggingOptions struct {
5658
func NewOnlineFeatureService(conf *OnlineFeatureServiceConfig, transformationCallback transformation.TransformationCallback) *OnlineFeatureService {
5759
repoConfig, err := registry.NewRepoConfigFromJSON(conf.RepoPath, conf.RepoConfig)
5860
if err != nil {
59-
log.Fatalln(err)
61+
return &OnlineFeatureService{
62+
err: err,
63+
}
6064
}
6165

6266
fs, err := feast.NewFeatureStore(repoConfig, transformationCallback)
6367
if err != nil {
64-
log.Fatalln(err)
68+
return &OnlineFeatureService{
69+
err: err,
70+
}
6571
}
6672

6773
// Notify these channels when receiving interrupt or termination signals from OS
@@ -121,6 +127,10 @@ func (s *OnlineFeatureService) GetEntityTypesMapByFeatureService(featureServiceN
121127
return joinKeyTypes, nil
122128
}
123129

130+
func (s *OnlineFeatureService) CheckForInstantiationError() error {
131+
return s.err
132+
}
133+
124134
func (s *OnlineFeatureService) GetOnlineFeatures(
125135
featureRefs []string,
126136
featureServiceName string,

sdk/python/feast/embedded_go/online_features_service.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import faulthandler
21
from functools import partial
32
from pathlib import Path
43
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
@@ -46,13 +45,16 @@ def __init__(
4645
self._transformation_callback = partial(transformation_callback, feature_store)
4746
self._logging_callback = partial(logging_callback, feature_store)
4847

48+
self._config = OnlineFeatureServiceConfig(
49+
RepoPath=repo_path, RepoConfig=repo_config.json()
50+
)
51+
4952
self._service = NewOnlineFeatureService(
50-
OnlineFeatureServiceConfig(
51-
RepoPath=repo_path, RepoConfig=repo_config.json()
52-
),
53-
self._transformation_callback,
53+
self._config, self._transformation_callback,
5454
)
55-
faulthandler.enable()
55+
56+
# This should raise an exception if there were any errors in NewOnlineFeatureService.
57+
self._service.CheckForInstantiationError()
5658

5759
def get_online_features(
5860
self,
@@ -244,6 +246,10 @@ def transformation_callback(
244246

245247
input_record = pa.RecordBatch._import_from_c(input_arr_ptr, input_schema_ptr)
246248

249+
# For some reason, the callback is called with `full_feature_names` as a 1 if True or 0 if false. This handles
250+
# the typeguard requirement.
251+
full_feature_names = bool(full_feature_names)
252+
247253
output = odfv.get_transformed_features_df(
248254
input_record.to_pandas(), full_feature_names=full_feature_names
249255
)

sdk/python/tests/integration/e2e/test_go_feature_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def grpc_client(grpc_server_port):
122122

123123

124124
@pytest.mark.integration
125-
# @pytest.mark.goserver Disabling because the go fs tests are flaking in CI. TODO(achals): uncomment after fixed.
125+
@pytest.mark.goserver
126126
def test_go_grpc_server(grpc_client):
127127
resp: GetOnlineFeaturesResponse = grpc_client.GetOnlineFeatures(
128128
GetOnlineFeaturesRequest(
@@ -148,7 +148,7 @@ def test_go_grpc_server(grpc_client):
148148

149149

150150
@pytest.mark.integration
151-
# @pytest.mark.goserver Disabling because the go fs tests are flaking in CI. TODO(achals): uncomment after fixed.
151+
@pytest.mark.goserver
152152
def test_go_http_server(http_server_port):
153153
response = requests.post(
154154
f"http://localhost:{http_server_port}/get-online-features",
@@ -186,7 +186,7 @@ def test_go_http_server(http_server_port):
186186

187187

188188
@pytest.mark.integration
189-
# @pytest.mark.goserver Disabling because the go fs tests are flaking in CI. TODO(achals): uncomment after fixed.
189+
@pytest.mark.goserver
190190
@pytest.mark.universal_offline_stores
191191
@pytest.mark.parametrize("full_feature_names", [True, False], ids=lambda v: str(v))
192192
def test_feature_logging(

sdk/python/tests/integration/online_store/test_universal_online.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def test_online_retrieval_with_event_timestamps(
443443

444444
@pytest.mark.integration
445445
@pytest.mark.universal_online_stores
446-
# @pytest.mark.goserver Disabling because the go fs tests are flaking in CI. TODO(achals): uncomment after fixed.
446+
@pytest.mark.goserver
447447
@pytest.mark.parametrize("full_feature_names", [True, False], ids=lambda v: str(v))
448448
def test_stream_feature_view_online_retrieval(
449449
environment, universal_data_sources, feature_server_endpoint, full_feature_names
@@ -519,7 +519,7 @@ def test_stream_feature_view_online_retrieval(
519519

520520
@pytest.mark.integration
521521
@pytest.mark.universal_online_stores
522-
# @pytest.mark.goserver Disabling because the go fs tests are flaking in CI. TODO(achals): uncomment after fixed.
522+
@pytest.mark.goserver
523523
@pytest.mark.parametrize("full_feature_names", [True, False], ids=lambda v: str(v))
524524
def test_online_retrieval(
525525
environment, universal_data_sources, feature_server_endpoint, full_feature_names

0 commit comments

Comments
 (0)