Skip to content

Commit

Permalink
feat(model): support model version deletion (#374)
Browse files Browse the repository at this point in the history
Because

- We are going to support model version deletion

This commit

- add repository tag deletion in artifact-backend contract
- add model version deletion in model-backend contract

---------

Co-authored-by: droplet-bot <[email protected]>
  • Loading branch information
heiruwu and droplet-bot committed Jun 24, 2024
1 parent afe1b7d commit 78cbc19
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 5 deletions.
11 changes: 11 additions & 0 deletions artifact/artifact/v1alpha/artifact.proto
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ message CreateRepositoryTagResponse {
RepositoryTag tag = 1;
}

// DeleteRepositoryTagRequest represents a request to delete a tag to a given
// repository.
message DeleteRepositoryTagRequest {
// The name of the tag, defined by its parent repository and ID.
// - Format: `repositories/{repository.id}/tags/{tag.id}`.
string name = 1 [(google.api.field_behavior) = REQUIRED];
}

// DeleteRepositoryTagResponse represent an empty response.
message DeleteRepositoryTagResponse {}

// KnowledgeBase represents a knowledge base.
message KnowledgeBase {
// The knowledge base identifier.
Expand Down
3 changes: 3 additions & 0 deletions artifact/artifact/v1alpha/artifact_private_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ service ArtifactPrivateService {
// or the tag digest, so `artifact-backend` will hold this information locally.
rpc CreateRepositoryTag(CreateRepositoryTagRequest) returns (CreateRepositoryTagResponse);

// Delete a repository tag.
rpc DeleteRepositoryTag(DeleteRepositoryTagRequest) returns (DeleteRepositoryTagResponse);

option (google.api.api_visibility).restriction = "INTERNAL";
}
48 changes: 45 additions & 3 deletions model/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,26 @@ message ListUserModelVersionsResponse {
int32 page = 4;
}

// DeleteUserModelVersionRequest represents a request to delete a model version
// owned by a user.
message DeleteUserModelVersionRequest {
// The resource name of the model, which allows its access by parent user
// and ID.
// - Format: `users/{user.id}/models/{model.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Model",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_model_name"}
}
];
// Model version tag
string version = 2 [(google.api.field_behavior) = REQUIRED];
}

// DeleteUserModelVersionResponse is an empty response.
message DeleteUserModelVersionResponse {}

////////////////////////////////////
// Trigger methods
////////////////////////////////////
Expand Down Expand Up @@ -1090,7 +1110,7 @@ message ListOrganizationModelVersionsRequest {
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Model",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_model_name"}
field_configuration: {path_param_name: "organization_model_name"}
}
];
}
Expand All @@ -1107,6 +1127,28 @@ message ListOrganizationModelVersionsResponse {
int32 page = 4;
}

// DeleteOrganizationModelVersionRequest represents a request to delete a model version
// owned by an organization.
message DeleteOrganizationModelVersionRequest {
// The parent resource, i.e., the user that created the models.
// - Format: `organizations/{organization.id}`.
// The resource name of the model, which allows its access by parent user
// and ID.
// - Format: `organizations/{organization.id}/models/{model.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Model",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization_model_name"}
}
];
// Model version tag
string version = 2 [(google.api.field_behavior) = REQUIRED];
}

// DeleteOrganizationModelVersionResponse is an empty response.
message DeleteOrganizationModelVersionResponse {}

// TriggerOrganizationModelRequest represents a request to trigger a model inference.
message TriggerOrganizationModelRequest {
// The resource name of the model , which allows its access by parent organization
Expand Down Expand Up @@ -1408,7 +1450,7 @@ message DeployOrganizationModelAdminRequest {
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Model",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_model_name"}
field_configuration: {path_param_name: "organization_model_name"}
}
];
// Model version tag
Expand Down Expand Up @@ -1457,7 +1499,7 @@ message UndeployOrganizationModelAdminRequest {
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Model",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_model_name"}
field_configuration: {path_param_name: "organization_model_name"}
}
];
// Model version tag
Expand Down
20 changes: 20 additions & 0 deletions model/model/v1alpha/model_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ service ModelPublicService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

// Delete a model version
//
// Deletes a model version, accesing it by its resource name, which is defined by the
// parent user and the ID of the model, and version.
rpc DeleteUserModelVersion(DeleteUserModelVersionRequest) returns (DeleteUserModelVersionResponse) {
option (google.api.http) = {delete: "/v1alpha/{name=users/*/models/*}/versions/{version=*}"};
option (google.api.method_signature) = "name";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

///////////////////////////////////////////////////////

// Trigger model inference
Expand Down Expand Up @@ -434,6 +444,16 @@ service ModelPublicService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

// Delete a model version
//
// Deletes a model version, accesing it by its resource name, which is defined by the
// parent organization and the ID of the model, and version.
rpc DeleteOrganizationModelVersion(DeleteOrganizationModelVersionRequest) returns (DeleteOrganizationModelVersionResponse) {
option (google.api.http) = {delete: "/v1alpha/{name=organizations/*/models/*}/versions/{version=*}"};
option (google.api.method_signature) = "name";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

///////////////////////////////////////////////////////

// Trigger model inference
Expand Down
3 changes: 3 additions & 0 deletions openapiv2/artifact/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ definitions:
$ref: '#/definitions/v1alphaKnowledgeBase'
description: The knowledge base identifier.
description: DeleteKnowledgeBaseResponse represents a response for deleting a knowledge base.
v1alphaDeleteRepositoryTagResponse:
type: object
description: DeleteRepositoryTagResponse represent an empty response.
v1alphaFile:
type: object
properties:
Expand Down
86 changes: 84 additions & 2 deletions openapiv2/model/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,43 @@ paths:
format: int32
tags:
- Model
/v1alpha/{user_model_name}/versions/{version}:
delete:
summary: Delete a model version
description: |-
Deletes a model version, accesing it by its resource name, which is defined by the
parent user and the ID of the model, and version.
operationId: ModelPublicService_DeleteUserModelVersion
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1alphaDeleteUserModelVersionResponse'
"401":
description: Returned when the client credentials are not valid.
schema: {}
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user_model_name
description: |-
The resource name of the model, which allows its access by parent user
and ID.
- Format: `users/{user.id}/models/{model.id}`.
in: path
required: true
type: string
pattern: users/[^/]+/models/[^/]+
- name: version
description: Model version tag
in: path
required: true
type: string
pattern: '[^/]+'
tags:
- Model
/v1alpha/{user_model_name}/versions/{version}/trigger:
post:
summary: Trigger model inference
Expand Down Expand Up @@ -1557,7 +1594,7 @@ paths:
pattern: organizations/[^/]+/models/[^/]+
tags:
- Model
/v1alpha/{user_model_name_1}/versions:
/v1alpha/{organization_model_name}/versions:
get:
summary: List organization model versions
description: |-
Expand All @@ -1577,7 +1614,7 @@ paths:
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user_model_name_1
- name: organization_model_name
description: |-
The parent resource, i.e., the user that created the models.
- Format: `organizations/{organization.id}`.
Expand All @@ -1604,6 +1641,45 @@ paths:
format: int32
tags:
- Model
/v1alpha/{organization_model_name}/versions/{version}:
delete:
summary: Delete a model version
description: |-
Deletes a model version, accesing it by its resource name, which is defined by the
parent organization and the ID of the model, and version.
operationId: ModelPublicService_DeleteOrganizationModelVersion
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1alphaDeleteOrganizationModelVersionResponse'
"401":
description: Returned when the client credentials are not valid.
schema: {}
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: organization_model_name
description: |-
The parent resource, i.e., the user that created the models.
- Format: `organizations/{organization.id}`.
The resource name of the model, which allows its access by parent user
and ID.
- Format: `organizations/{organization.id}/models/{model.id}`.
in: path
required: true
type: string
pattern: organizations/[^/]+/models/[^/]+
- name: version
description: Model version tag
in: path
required: true
type: string
pattern: '[^/]+'
tags:
- Model
/v1alpha/{organization_model_name}/versions/{version}/trigger:
post:
summary: Trigger model inference
Expand Down Expand Up @@ -2361,9 +2437,15 @@ definitions:
v1alphaDeleteOrganizationModelResponse:
type: object
description: DeleteOrganizationModelResponse is an empty response.
v1alphaDeleteOrganizationModelVersionResponse:
type: object
description: DeleteOrganizationModelVersionResponse is an empty response.
v1alphaDeleteUserModelResponse:
type: object
description: DeleteUserModelResponse is an empty response.
v1alphaDeleteUserModelVersionResponse:
type: object
description: DeleteUserModelVersionResponse is an empty response.
v1alphaDeployOrganizationModelAdminResponse:
type: object
title: DeployOrganizationModelAdminResponse represents a response for a deployed model
Expand Down

0 comments on commit 78cbc19

Please sign in to comment.