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
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ def update(
logger.error(
f"Feature group '{self.feature_group_name}' was not updated successfully: {e}"
)
raise

# Update Iceberg properties if requested
if iceberg_properties is not None and iceberg_properties.properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,35 @@ def test_skips_parent_update_when_only_iceberg_properties(
mock_update_iceberg.assert_called_once()
assert result == fg

@patch.object(FeatureGroupManager, "_update_iceberg_properties")
@patch("sagemaker.core.resources.Base.get_sagemaker_client")
def test_parent_update_failure_is_raised(self, mock_get_client, mock_update_iceberg):
"""A failed UpdateFeatureGroup must surface, and Iceberg properties must not be updated."""
from botocore.exceptions import ClientError
from sagemaker.core.shapes import OfflineStoreConfig, S3StorageConfig, DataCatalogConfig

mock_client = MagicMock()
mock_client.update_feature_group.side_effect = ClientError(
{"Error": {"Code": "ValidationException", "Message": "bad throughput"}},
"UpdateFeatureGroup",
)
mock_get_client.return_value = mock_client

fg = FeatureGroupManager(feature_group_name="test-fg")
fg.offline_store_config = OfflineStoreConfig(
s3_storage_config=S3StorageConfig(s3_uri="s3://bucket/path"),
data_catalog_config=DataCatalogConfig(
catalog="AwsDataCatalog", database="db", table_name="tbl"
),
table_format="Iceberg",
)
iceberg_props = IcebergProperties(properties={"write.target-file-size-bytes": "536870912"})

with pytest.raises(ClientError, match="bad throughput"):
fg.update(feature_additions=[], iceberg_properties=iceberg_props)

mock_update_iceberg.assert_not_called()

@patch.object(FeatureGroupManager, "_update_iceberg_properties")
@patch.object(FeatureGroupManager, "refresh")
@patch("sagemaker.core.resources.Base.get_sagemaker_client")
Expand Down
Loading