feat: stub and document reaper support for FS 2.x (#2521)

This commit is contained in:
Andrew Ferlitsch
2023-11-15 22:04:01 +00:00
committed by GitHub
parent dbaa3d098c
commit ed6de9fde5
2 changed files with 24 additions and 5 deletions
+2
View File
@@ -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