Skip to content

Commit a28b151

Browse files
committed
fix: Fix regstry Rest API tests intermittent failure
Signed-off-by: Srihari <svenkata@redhat.com>
1 parent 6b31a43 commit a28b151

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

sdk/python/feast/infra/registry/sql.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,21 @@ def _sync_feast_metadata_to_projects_table(self):
302302
# Find object in feast_metadata_projects but not in projects
303303
projects_to_sync = set(feast_metadata_projects.keys()) - set(projects_set)
304304
for project_name in projects_to_sync:
305-
self.apply_project(
306-
Project(
307-
name=project_name,
308-
created_timestamp=datetime.fromtimestamp(
309-
feast_metadata_projects[project_name], tz=timezone.utc
305+
try:
306+
self.apply_project(
307+
Project(
308+
name=project_name,
309+
created_timestamp=datetime.fromtimestamp(
310+
feast_metadata_projects[project_name], tz=timezone.utc
311+
),
310312
),
311-
),
312-
commit=True,
313-
)
313+
commit=True,
314+
)
315+
except IntegrityError:
316+
logger.info(
317+
"Project %s already created in projects table by another process.",
318+
project_name,
319+
)
314320

315321
if self.purge_feast_metadata:
316322
with self.write_engine.begin() as conn:

sdk/python/tests/integration/rest_api/conftest.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ def get(self, endpoint, params=None):
3737
return requests.get(url, params=params, verify=False)
3838

3939

40-
def _wait_for_http_ready(route_url: str, timeout: int = 180, interval: int = 5) -> None:
40+
def _wait_for_http_ready(
41+
route_url: str,
42+
timeout: int = 300,
43+
interval: int = 5,
44+
initial_delay: int = 30,
45+
) -> None:
4146
"""
4247
Poll the HTTP endpoint until it returns a non-502 response.
4348
@@ -46,9 +51,15 @@ def _wait_for_http_ready(route_url: str, timeout: int = 180, interval: int = 5)
4651
start before the Feast server is ready, causing all requests to return 502.
4752
"""
4853
health_url = f"{route_url}/api/v1/projects"
49-
deadline = time.time() + timeout
5054
last_status = None
5155

56+
if initial_delay > 0:
57+
print(
58+
f"\n Waiting {initial_delay}s for backend to start after apply/dataset creation..."
59+
)
60+
time.sleep(initial_delay)
61+
62+
deadline = time.time() + timeout
5263
print(
5364
f"\n Waiting for HTTP endpoint to become ready (timeout={timeout}s): {health_url}"
5465
)

0 commit comments

Comments
 (0)