Skip to content

Commit 468e6e7

Browse files
matthew29tangcopybara-github
authored andcommitted
fix: fix feature update since no LRO is created
PiperOrigin-RevId: 562005959
1 parent 2bd494b commit 468e6e7

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

google/cloud/aiplatform/featurestore/feature.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,12 @@ def update(
238238
self,
239239
)
240240

241-
update_feature_lro = self.api_client.update_feature(
241+
self._gca_resource = self.api_client.update_feature(
242242
feature=gapic_feature,
243243
update_mask=update_mask,
244244
metadata=request_metadata,
245245
timeout=update_request_timeout,
246246
)
247-
248-
_LOGGER.log_action_started_against_resource_with_lro(
249-
"Update", "feature", self.__class__, update_feature_lro
250-
)
251-
252-
update_feature_lro.result()
253-
254-
_LOGGER.log_action_completed_against_resource("feature", "updated", self)
255-
256247
return self
257248

258249
@classmethod

tests/unit/aiplatform/test_featurestores.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from google.cloud.aiplatform.utils import resource_manager_utils
3636

3737
from google.cloud.aiplatform.utils import featurestore_utils
38+
from google.cloud.aiplatform.featurestore.feature import Feature
3839
from google.cloud.aiplatform.compat.services import (
3940
featurestore_service_client,
4041
)
@@ -721,8 +722,10 @@ def update_feature_mock():
721722
with patch.object(
722723
featurestore_service_client.FeaturestoreServiceClient, "update_feature"
723724
) as update_feature_mock:
724-
update_feature_lro_mock = mock.Mock(operation.Operation)
725-
update_feature_mock.return_value = update_feature_lro_mock
725+
update_feature_mock.return_value = gca_feature.Feature(
726+
name=_TEST_FEATURE_NAME,
727+
value_type=_TEST_FEATURE_VALUE_TYPE_ENUM,
728+
)
726729
yield update_feature_mock
727730

728731

@@ -3693,7 +3696,7 @@ def test_update_feature(self, update_feature_mock):
36933696
aiplatform.init(project=_TEST_PROJECT)
36943697

36953698
my_feature = aiplatform.Feature(feature_name=_TEST_FEATURE_NAME)
3696-
my_feature.update(
3699+
updated_feature = my_feature.update(
36973700
labels=_TEST_LABELS_UPDATE,
36983701
update_request_timeout=None,
36993702
)
@@ -3709,6 +3712,8 @@ def test_update_feature(self, update_feature_mock):
37093712
timeout=None,
37103713
)
37113714

3715+
assert isinstance(updated_feature, Feature)
3716+
37123717
@pytest.mark.parametrize(
37133718
"entity_type_name, featurestore_id",
37143719
[

0 commit comments

Comments
 (0)