Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/unit/vertexai/test_vertexai_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,25 @@ def test_init_with_feature_id(get_feature_mock):
)


def test_init_with_feature_id_uses_the_given_project_and_location(get_feature_mock):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)

Feature(
name=_TEST_FG1_F1_ID,
feature_group_id=_TEST_FG1_ID,
project="other-project",
location="europe-west4",
)

get_feature_mock.assert_called_once_with(
name=(
"projects/other-project/locations/europe-west4/"
f"featureGroups/{_TEST_FG1_ID}/features/{_TEST_FG1_F1_ID}"
),
retry=base._DEFAULT_RETRY,
)


def test_init_with_feature_id_for_explicit_version_column(
get_feature_with_version_column_mock,
):
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/vertexai/test_vertexai_feature_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,27 @@ def test_init_with_feature_monitor_path_and_fg_id_raises_error():
)


def test_init_with_feature_monitor_id_uses_the_given_project_and_location(
get_feature_monitor_mock,
):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)

FeatureMonitor(
_TEST_FG1_FM1_ID,
feature_group_id=_TEST_FG1_ID,
project="other-project",
location="europe-west4",
)

get_feature_monitor_mock.assert_called_once_with(
name=(
"projects/other-project/locations/europe-west4/"
f"featureGroups/{_TEST_FG1_ID}/featureMonitors/{_TEST_FG1_FM1_ID}"
),
retry=base._DEFAULT_RETRY,
)


def test_init_with_feature_monitor_id(get_feature_monitor_mock):
aiplatform.init(
project=_TEST_PROJECT,
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/vertexai/test_vertexai_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,25 @@ def test_init_with_fv_id_and_no_fos_id_raises_error(get_fv_mock):
FeatureView(_TEST_FV1_ID)


def test_init_with_fv_id_uses_the_given_project_and_location(get_fv_mock):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)

FeatureView(
name=_TEST_FV1_ID,
feature_online_store_id=_TEST_BIGTABLE_FOS1_ID,
project="other-project",
location="europe-west4",
)

get_fv_mock.assert_called_once_with(
name=(
"projects/other-project/locations/europe-west4/"
f"featureOnlineStores/{_TEST_BIGTABLE_FOS1_ID}/featureViews/{_TEST_FV1_ID}"
),
retry=base._DEFAULT_RETRY,
)


def test_init_with_fv_id(get_fv_mock):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)

Expand Down
2 changes: 2 additions & 0 deletions vertexai/resources/preview/feature_store/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def __init__(
resource_noun=FeatureGroup._resource_noun,
parse_resource_name_method=FeatureGroup._parse_resource_name,
format_resource_name_method=FeatureGroup._format_resource_name,
project=project,
location=location,
)

feature = f"{feature_group_path}/features/{name}"
Expand Down
2 changes: 2 additions & 0 deletions vertexai/resources/preview/feature_store/feature_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def __init__(
resource_noun=FeatureGroup._resource_noun,
parse_resource_name_method=FeatureGroup._parse_resource_name,
format_resource_name_method=FeatureGroup._format_resource_name,
project=project,
location=location,
)

feature_monitor = f"{feature_group_path}/featureMonitors/{name}"
Expand Down
2 changes: 2 additions & 0 deletions vertexai/resources/preview/feature_store/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def __init__(
resource_noun=FeatureOnlineStore._resource_noun,
parse_resource_name_method=FeatureOnlineStore._parse_resource_name,
format_resource_name_method=FeatureOnlineStore._format_resource_name,
project=project,
location=location,
)

feature_view = f"{feature_online_store_path}/featureViews/{name}"
Expand Down