Skip to content

Commit

Permalink
feat(run): run logging dashboard list APIs for model and pipeline (#488)
Browse files Browse the repository at this point in the history
This pull request is related to
#472 but only includes the
ones for run logging data lists, excluding metrics APIs

Because

- the data that users could see on dashboard are different from what
they can see on Runs page in a single pipeline or model

This commit

- add new run logging API for dashboard

---------

Co-authored-by: droplet-bot <[email protected]>
  • Loading branch information
joremysh and droplet-bot authored Oct 12, 2024
1 parent 08b6738 commit a24f2ae
Show file tree
Hide file tree
Showing 6 changed files with 379 additions and 31 deletions.
48 changes: 46 additions & 2 deletions model/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,11 @@ message ModelRun {
repeated google.protobuf.Struct task_inputs = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
// Model inference outputs.
repeated google.protobuf.Struct task_outputs = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
// Model ID.
optional string model_id = 15 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = OPTIONAL
];
}

// ListModelRunsRequest represents a request to list of model runs.
Expand All @@ -1774,9 +1779,9 @@ message ListModelRunsRequest {
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page number.
optional int32 page = 2 [(google.api.field_behavior) = OPTIONAL];
// View allows clients to specify the desired run view in the response.
// Deprecated: View allows clients to specify the desired run view in the response.
// The basic view excludes input / output data.
optional View view = 3 [(google.api.field_behavior) = OPTIONAL];
reserved 3;
// Sort the results by the given expression.
// Format: `field [ASC | DESC], where `field` can be:
// - `create_time`
Expand All @@ -1795,6 +1800,33 @@ message ListModelRunsRequest {
optional string filter = 7 [(google.api.field_behavior) = OPTIONAL];
}

// ListModelRunsByCreditOwnerRequest is the request message for ListModelRunsByCreditOwner.
message ListModelRunsByCreditOwnerRequest {
// The maximum number of runs to return. The default and cap values are 10
// and 100, respectively.
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page number.
optional int32 page = 2 [(google.api.field_behavior) = OPTIONAL];
// Sort the results by the given expression.
// Format: `field [ASC | DESC], where `field` can be:
// - `create_time`
// - `update_time`
// By default, results are sorted by descending creation time.
optional string order_by = 3 [(google.api.field_behavior) = OPTIONAL];
// Filter can hold an [AIP-160](https://google.aip.dev/160)-compliant filter
// expression.
// - Example: `create_time>timestamp("2000-06-19T23:31:08.657Z")`.
// The filter can be applied to the following fields:
// - `create_time`
optional string filter = 4 [(google.api.field_behavior) = OPTIONAL];
// Beginning of the time range from which the records will be fetched.
// The default value is the beginning of the current day, in UTC.
optional google.protobuf.Timestamp start = 5;
// End of the time range from which the records will be fetched.
// The default value is the current timestamp.
optional google.protobuf.Timestamp stop = 6;
}

// ListModelRunsResponse contains a list of model runs.
message ListModelRunsResponse {
// A list of runs resources.
Expand All @@ -1806,3 +1838,15 @@ message ListModelRunsResponse {
// The requested page offset.
int32 page = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// ListModelRunsByCreditOwnerResponse is the request message for ListModelRunsByCreditOwner.
message ListModelRunsByCreditOwnerResponse {
// A list of runs resources.
repeated ModelRun runs = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Total number of runs.
int32 total_size = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// The requested page size.
int32 page_size = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// The requested page offset.
int32 page = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}
29 changes: 28 additions & 1 deletion model/model/v1alpha/model_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,33 @@ service ModelPublicService {
// Returns a paginated list of model runs.
rpc ListModelRuns(ListModelRunsRequest) returns (ListModelRunsResponse) {
option (google.api.http) = {get: "/v1alpha/namespaces/{namespace_id}/models/{model_id}/runs"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Trigger"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Trigger"
parameters: {
headers: {
name: "Instill-Requester-Uid"
description: "Indicates the authenticated namespace is making the request on behalf of another entity, typically an organization they belong to"
type: STRING
}
}
};
}

// List Model Runs of a Namespace (user or organization)
//
// Returns a paginated list of runs for 1 or more models. This is mainly used by credit dashboard.
// The requester can view all the runs that consumed their credits across different models.
rpc ListModelRunsByCreditOwner(ListModelRunsByCreditOwnerRequest) returns (ListModelRunsByCreditOwnerResponse) {
option (google.api.http) = {get: "/v1alpha/dashboard/models/runs"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Trigger"
parameters: {
headers: {
name: "Instill-Requester-Uid"
description: "Indicates the authenticated namespace is making the request on behalf of another entity, typically an organization they belong to"
type: STRING
}
}
};
}
}
117 changes: 108 additions & 9 deletions openapiv2/model/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -990,19 +990,67 @@ paths:
required: false
type: integer
format: int32
- name: view
- name: orderBy
description: |-
View allows clients to specify the desired run view in the response.
The basic view excludes input / output data.
- VIEW_BASIC: Default view, only includes basic information (omits `model_spec`).
- VIEW_FULL: Full representation.
Sort the results by the given expression.
Format: `field [ASC | DESC], where `field` can be:
- `create_time`
- `update_time`
By default, results are sorted by descending creation time.
in: query
required: false
type: string
enum:
- VIEW_BASIC
- VIEW_FULL
- name: filter
description: |-
Filter can hold an [AIP-160](https://google.aip.dev/160)-compliant filter
expression.
- Example: `create_time>timestamp("2000-06-19T23:31:08.657Z")`.
The filter can be applied to the following fields:
- `create_time`
in: query
required: false
type: string
- name: Instill-Requester-Uid
description: Indicates the authenticated namespace is making the request on behalf of another entity, typically an organization they belong to
in: header
required: false
type: string
tags:
- Trigger
/v1alpha/dashboard/models/runs:
get:
summary: List Model Runs of a Namespace (user or organization)
description: |-
Returns a paginated list of runs for 1 or more models. This is mainly used by credit dashboard.
The requester can view all the runs that consumed their credits across different models.
operationId: ModelPublicService_ListModelRunsByCreditOwner
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1alphaListModelRunsByCreditOwnerResponse'
"401":
description: Returned when the client credentials are not valid.
schema: {}
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: pageSize
description: |-
The maximum number of runs to return. The default and cap values are 10
and 100, respectively.
in: query
required: false
type: integer
format: int32
- name: page
description: Page number.
in: query
required: false
type: integer
format: int32
- name: orderBy
description: |-
Sort the results by the given expression.
Expand All @@ -1023,6 +1071,27 @@ paths:
in: query
required: false
type: string
- name: start
description: |-
Beginning of the time range from which the records will be fetched.
The default value is the beginning of the current day, in UTC.
in: query
required: false
type: string
format: date-time
- name: stop
description: |-
End of the time range from which the records will be fetched.
The default value is the current timestamp.
in: query
required: false
type: string
format: date-time
- name: Instill-Requester-Uid
description: Indicates the authenticated namespace is making the request on behalf of another entity, typically an organization they belong to
in: header
required: false
type: string
tags:
- Trigger
definitions:
Expand Down Expand Up @@ -1458,6 +1527,32 @@ definitions:
format: int32
description: Total number of model definitions.
description: ListModelDefinitionsResponse contains a list of model definitions.
v1alphaListModelRunsByCreditOwnerResponse:
type: object
properties:
runs:
type: array
items:
type: object
$ref: '#/definitions/v1alphaModelRun'
description: A list of runs resources.
readOnly: true
totalSize:
type: integer
format: int32
description: Total number of runs.
readOnly: true
pageSize:
type: integer
format: int32
description: The requested page size.
readOnly: true
page:
type: integer
format: int32
description: The requested page offset.
readOnly: true
description: ListModelRunsByCreditOwnerResponse is the request message for ListModelRunsByCreditOwner.
v1alphaListModelRunsResponse:
type: object
properties:
Expand Down Expand Up @@ -1829,6 +1924,10 @@ definitions:
type: object
description: Model inference outputs.
readOnly: true
modelId:
type: string
description: Model ID.
readOnly: true
description: ModelRun contains information about a run of models.
v1alphaModelVersion:
type: object
Expand Down
Loading

0 comments on commit a24f2ae

Please sign in to comment.