Skip to content

Commit 2df34a2

Browse files
committed
fix: detect duplicate feature view/data source names at parse time
Move duplicate feature view and data source name validation into parse_repo(), so it runs before FeatureStore and its heavy dependencies (Dask, PySpark) are initialized. Previously this validation happened deep inside store.plan()/store.apply(), after those had already been set up, which meant a slow atexit shutdown could kill the CLI subprocess (SIGKILL on timeout) before the error was ever reported - causing test_cli_apply_duplicated_featureview_names and related tests to fail intermittently in CI with empty output and no clear cause. Also add explicit FeastError handling to the plan/apply CLI commands so these (and other) validation errors surface as a clean message with a non-zero exit code, instead of an unhandled traceback. Fixes #6417
1 parent f771ea4 commit 2df34a2

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

sdk/python/feast/cli/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from feast.cli.ui import ui
5353
from feast.cli.validation_references import validation_references_cmd
5454
from feast.constants import FEAST_FS_YAML_FILE_PATH_ENV_NAME
55-
from feast.errors import FeastProviderLoginError
55+
from feast.errors import FeastError, FeastProviderLoginError
5656
from feast.repo_config import load_repo_config
5757
from feast.repo_operations import (
5858
apply_total,
@@ -261,6 +261,8 @@ def plan_command(
261261
plan(repo_config, repo, skip_source_validation, skip_feature_view_validation)
262262
except FeastProviderLoginError as e:
263263
print(str(e))
264+
except FeastError as e:
265+
raise click.ClickException(str(e))
264266

265267

266268
@cli.command("apply", cls=NoOptionDefaultFormat)
@@ -319,6 +321,8 @@ def apply_total_command(
319321
)
320322
except FeastProviderLoginError as e:
321323
print(str(e))
324+
except FeastError as e:
325+
raise click.ClickException(str(e))
322326

323327

324328
@cli.command("teardown", cls=NoOptionDefaultFormat)

sdk/python/feast/repo_operations.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
from feast.diff.registry_diff import extract_objects_for_keep_delete_update_add
2323
from feast.entity import Entity
2424
from feast.feature_service import FeatureService
25-
from feast.feature_store import FeatureStore
25+
from feast.feature_store import (
26+
FeatureStore,
27+
_validate_data_sources,
28+
_validate_feature_views,
29+
)
2630
from feast.feature_view import DUMMY_ENTITY, FeatureView
2731
from feast.file_utils import replace_str_in_file
2832
from feast.infra.registry.base_registry import BaseRegistry
@@ -238,6 +242,20 @@ def parse_repo(repo_root: Path) -> RepoContents:
238242
res.projects.append(obj)
239243

240244
res.entities.append(DUMMY_ENTITY)
245+
246+
# Fail fast on duplicate feature view / data source names, before any
247+
# heavy dependencies (FeatureStore, Dask, PySpark) are initialized. See
248+
# https://github.com/feast-dev/feast/issues/6417 - detecting this later,
249+
# inside store.plan()/store.apply(), risks the error being masked by a
250+
# slow subprocess/atexit shutdown timing out before it can be reported.
251+
_validate_feature_views(
252+
res.feature_views
253+
+ res.on_demand_feature_views
254+
+ res.stream_feature_views
255+
+ res.label_views
256+
)
257+
_validate_data_sources(res.data_sources)
258+
241259
return res
242260

243261

0 commit comments

Comments
 (0)