Skip to content

Commit

Permalink
chore(model): support listing available region for model deployment (#…
Browse files Browse the repository at this point in the history
…320)

Because

- We need to provide the info about supported regions and hardware for
FE to render the model creation page

This commit

- add list available region method

---------

Co-authored-by: droplet-bot <[email protected]>
  • Loading branch information
heiruwu and droplet-bot authored May 10, 2024
1 parent 8604324 commit 610f0a3
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
20 changes: 20 additions & 0 deletions model/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ message ReadinessResponse {
common.healthcheck.v1beta.HealthCheckResponse health_check_response = 1;
}

// Region describes the supported cloud provider and regions, with
// their supported GPU respectively.
message Region {
// Concate name of provider and region
string region_name = 1;
// Hardware describes the available hardware types in this region
repeated string hardware = 2;
}

// State describes the state of a model. See [Deploy
// Models](https://www.instill.tech/docs/latest/model/deploy) for more
// information.
Expand Down Expand Up @@ -1071,6 +1080,17 @@ message GetModelOperationResponse {
google.longrunning.Operation operation = 1;
}

// ListAvailableRegionsRequest represents a request to fetch a list
// of available regions and hardware types a model can be deployed on.
message ListAvailableRegionsRequest {}

// ListAvailableRegionsResponse contains a list of available
// regions and hardware types a model can be deployed on.
message ListAvailableRegionsResponse {
// A list of available region
repeated Region regions = 1;
}

// ========== Private endpoints

// ListModelsAdminRequest represents a request to list all models from all users
Expand Down
2 changes: 1 addition & 1 deletion model/model/v1alpha/model_definition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ enum View {
// definitions.
message ListModelDefinitionsRequest {
// The maximum number of model definitions to return. If this parameter
// is unspecified, at most 10 pipelines will be returned. The cap value for
// is unspecified, at most 10 definitions will be returned. The cap value for
// this parameter is 100 (i.e. any value above that will be coerced to 100).
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page token.
Expand Down
8 changes: 8 additions & 0 deletions model/model/v1alpha/model_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ service ModelPublicService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

// List available regions
//
// Returns a paginated list of available regions.
rpc ListAvailableRegions(ListAvailableRegionsRequest) returns (ListAvailableRegionsResponse) {
option (google.api.http) = {get: "/v1alpha/available-regions"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Model"};
}

// Get a model definition
//
// Returns the details of a model definition.
Expand Down
47 changes: 46 additions & 1 deletion openapiv2/model/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ paths:
- name: page_size
description: |-
The maximum number of model definitions to return. If this parameter
is unspecified, at most 10 pipelines will be returned. The cap value for
is unspecified, at most 10 definitions will be returned. The cap value for
this parameter is 100 (i.e. any value above that will be coerced to 100).
in: query
required: false
Expand All @@ -67,6 +67,25 @@ paths:
- VIEW_FULL
tags:
- Model
/v1alpha/available-regions:
get:
summary: List available regions
description: Returns a paginated list of available regions.
operationId: ModelPublicService_ListAvailableRegions
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1alphaListAvailableRegionsResponse'
"401":
description: Returned when the client credentials are not valid.
schema: {}
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- Model
/v1alpha/{model_definition_name}:
get:
summary: Get a model definition
Expand Down Expand Up @@ -2224,6 +2243,18 @@ definitions:
description: A list of keypoint objects.
readOnly: true
description: KeypointOutput represents the result of a keypoint detection task.
v1alphaListAvailableRegionsResponse:
type: object
properties:
regions:
type: array
items:
type: object
$ref: '#/definitions/v1alphaRegion'
title: A list of available region
description: |-
ListAvailableRegionsResponse contains a list of available
regions and hardware types a model can be deployed on.
v1alphaListModelDefinitionsResponse:
type: object
properties:
Expand Down Expand Up @@ -2711,6 +2742,20 @@ definitions:
$ref: '#/definitions/v1alphaModel'
description: The published model resource.
description: PublishUserModelResponse contains a published model.
v1alphaRegion:
type: object
properties:
region_name:
type: string
title: Concate name of provider and region
hardware:
type: array
items:
type: string
title: Hardware describes the available hardware types in this region
description: |-
Region describes the supported cloud provider and regions, with
their supported GPU respectively.
v1alphaReleaseStage:
type: string
enum:
Expand Down

0 comments on commit 610f0a3

Please sign in to comment.