mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
feat: stub and document reaper support for FS 2.x (#2521)
This commit is contained in:
@@ -16,6 +16,7 @@ from resource_cleanup_manager import (
|
||||
ResourceCleanupManager,
|
||||
MatchingEngineIndexEndpointResourceCleanupManager,
|
||||
MatchingEngineIndexResourceCleanupManager,
|
||||
FeatureStoreLegacyCleanupManager,
|
||||
FeatureStoreCleanupManager,
|
||||
PipelineJobCleanupManager,
|
||||
TrainingJobCleanupManager,
|
||||
@@ -62,6 +63,7 @@ managers: List[ResourceCleanupManager] = [
|
||||
ModelResourceCleanupManager(), # ModelResourceCleanupManager must follow EndpointResourceCleanupManager due to deployed models blocking model deletion.
|
||||
MatchingEngineIndexEndpointResourceCleanupManager(),
|
||||
MatchingEngineIndexResourceCleanupManager(),
|
||||
FeatureStoreLegacyCleanupManager(),
|
||||
FeatureStoreCleanupManager(),
|
||||
PipelineJobCleanupManager(),
|
||||
TrainingJobCleanupManager(),
|
||||
|
||||
@@ -11,6 +11,7 @@ import abc
|
||||
from typing import Any, Type
|
||||
|
||||
from google.cloud import aiplatform
|
||||
from google.cloud import aiplatform_v1beta1 as v1beta1
|
||||
from google.cloud.aiplatform import base
|
||||
from google.cloud import storage
|
||||
from proto.datetime_helpers import DatetimeWithNanoseconds
|
||||
@@ -129,19 +130,35 @@ class MatchingEngineIndexEndpointResourceCleanupManager(VertexAIResourceCleanupM
|
||||
resource.undeploy_all()
|
||||
resource.delete(force=True)
|
||||
|
||||
class FeatureStoreCleanupManager(VertexAIResourceCleanupManager):
|
||||
class FeatureStoreLegacyCleanupManager(VertexAIResourceCleanupManager):
|
||||
# TODO: only deleting legacy
|
||||
# not deleting ingestions jobs
|
||||
# ingest_from_xxx methods do not return a job ID, there is no list command, aka no python way to delete
|
||||
# not deleting batch serving jobs
|
||||
# batch_serve_to_xxx methods do not return a job ID, there is no list command, aka no python way to delete
|
||||
vertex_ai_resource = aiplatform.Featurestore
|
||||
|
||||
# for FS 2.0
|
||||
# TODO: use _v1beta1, and gapic clients
|
||||
# delete features, feature groups, feature views, feature online stores
|
||||
|
||||
def resource_name(self, resource: Any) -> str:
|
||||
return resource.name
|
||||
|
||||
|
||||
class FeatureStoreCleanupManager(VertexAIResourceCleanupManager):
|
||||
# for FS 2.0
|
||||
# TODO: use _v1beta1, and gapic clients
|
||||
# delete features, feature groups, feature views, feature online stores
|
||||
vertex_ai_resource = v1beta1.FeatureOnlineStore
|
||||
|
||||
def resource_name(self, resource: Any) -> str:
|
||||
return resource.name
|
||||
|
||||
def type_name(self) -> str:
|
||||
return "FeatureOnlineStore"
|
||||
|
||||
# TODO: FeatureOnlineStore has no list method
|
||||
def list(self) -> Any:
|
||||
return []
|
||||
|
||||
|
||||
class PipelineJobCleanupManager(VertexAIResourceCleanupManager):
|
||||
vertex_ai_resource = aiplatform.PipelineJob
|
||||
|
||||
|
||||
Reference in New Issue
Block a user