Skip to content

Commit 2b7e047

Browse files
authored
Merge pull request feast-dev#48 from farfetch-external/KE-799_fix_databricks_issue
Add timeouts for gRPC connections
2 parents 559bf4a + 8125b7f commit 2b7e047

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎tests/ds_scenarios/test-ingest.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
FRAUD_COUNTS_FEATURE_SET, create_fraud_counts_df,
1212
)
1313

14+
_GRPC_CONNECTION_TIMEOUT_DEFAULT = 20
15+
16+
_GRPC_CONNECTION_TIMEOUT_APPLY_KEY = 1200
17+
1418
PROJECT_NAME = 'ds_' + uuid.uuid4().hex.upper()[0:6]
1519

1620

@@ -33,7 +37,10 @@ def allow_dirty(pytestconfig):
3337
@pytest.fixture(scope='module')
3438
def client(core_url, serving_url, allow_dirty):
3539
# Get client for core and serving
36-
client = Client(core_url=core_url, serving_url=serving_url)
40+
client = Client(core_url=core_url, serving_url=serving_url,
41+
grpc_connection_timeout_default=_GRPC_CONNECTION_TIMEOUT_DEFAULT,
42+
grpc_connection_timeout_apply_key=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY,
43+
batch_feature_request_wait_time_seconds=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY)
3744
client.create_project(PROJECT_NAME)
3845

3946
# Ensure Feast core is active, but empty
@@ -54,7 +61,7 @@ def client(core_url, serving_url, allow_dirty):
5461
(create_fraud_counts_df, FRAUD_COUNTS_FEATURE_SET),
5562
])
5663
def test_ingestion(client, data_frame_generator, feature_set):
64+
client.set_project(PROJECT_NAME)
5765
client.apply(feature_set)
5866
data_frame = data_frame_generator()
59-
client.ingest(feature_set, data_frame)
60-
67+
client.ingest(feature_set, data_frame, timeout=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY)

‎tests/e2e/databricks-tests.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
from feast.feature import Feature
2121
import uuid
2222

23+
_GRPC_CONNECTION_TIMEOUT_APPLY_KEY = 1200
24+
25+
_GRPC_CONNECTION_TIMEOUT_DEFAULT = 20
26+
2327
FLOAT_TOLERANCE = 0.00001
2428
PROJECT_NAME = 'basic_' + uuid.uuid4().hex.upper()[0:6]
2529

@@ -43,7 +47,10 @@ def allow_dirty(pytestconfig):
4347
@pytest.fixture(scope='module')
4448
def client(core_url, serving_url, allow_dirty):
4549
# Get client for core and serving
46-
client = Client(core_url=core_url, serving_url=serving_url)
50+
client = Client(core_url=core_url, serving_url=serving_url,
51+
grpc_connection_timeout_default=_GRPC_CONNECTION_TIMEOUT_DEFAULT,
52+
grpc_connection_timeout_apply_key=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY,
53+
batch_feature_request_wait_time_seconds=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY)
4754
client.create_project(PROJECT_NAME)
4855
client.set_project(PROJECT_NAME)
4956

@@ -199,7 +206,7 @@ def test_all_types_ingest_success(client, all_types_dataframe):
199206
all_types_fs = client.get_feature_set(name="all_types")
200207

201208
# Ingest user embedding data
202-
client.ingest(all_types_fs, all_types_dataframe, timeout=1200)
209+
client.ingest(all_types_fs, all_types_dataframe, timeout=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY)
203210

204211

205212
@pytest.mark.databricks_skip
@@ -304,7 +311,7 @@ def test_large_volume_ingest_success(client, large_volume_dataframe):
304311
cust_trans_fs = client.get_feature_set(name="customer_transactions_large")
305312

306313
# Ingest customer transaction data
307-
client.ingest(cust_trans_fs, large_volume_dataframe, timeout=1200)
314+
client.ingest(cust_trans_fs, large_volume_dataframe, timeout=_GRPC_CONNECTION_TIMEOUT_APPLY_KEY)
308315

309316

310317
@pytest.mark.timeout(300)

0 commit comments

Comments
 (0)