Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vdp): Add Paginated List of logged Pipeline Runs Endpoint #413

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(vdp): Add Paginated List of logged Pipeline Runs Endpoint
Because:

- Users need to retrieve pipeline runs efficiently, either for specific pipelines or across all accessible pipelines.

This commit:

- Returns a paginated list of pipeline runs.
- Supports querying for specific pipelines or all accessible pipelines.
- Adds a gRPC method `ListPipelineRuns` with corresponding request and response types.
- Exposes the endpoint via HTTP GET at `/v1beta/pipeline-runs`.
- Tags the endpoint with "PipelineRun" for better API documentation.
  • Loading branch information
tillknuesting committed Aug 6, 2024
commit 0fc1dcff0ededc354cd39b7dbedb4ecfefbc5ce9
186 changes: 186 additions & 0 deletions vdp/pipeline/v1beta/pipeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1938,3 +1938,189 @@ message LookUpPipelineAdminResponse {
// The requested pipeline.
Pipeline pipeline = 1;
}

// ListPipelineRunsRequest is the request message for ListPipelineRuns.
message ListPipelineRunsRequest {
// The namespace to list pipeline runs for.
string namespace = 1;

// The page number to retrieve (1-based).
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
int32 page = 2;

// The number of items per page.
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
int32 page_size = 3;
}

// ListPipelineRunsResponse is the response message for ListPipelineRuns.
message ListPipelineRunsResponse {
// The list of pipeline runs.
repeated PipelineRun pipeline_runs = 1;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// The total number of pipeline runs matching the request.
int64 total_count = 2;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// The current page number.
int32 page = 3;

// The number of items per page.
int32 page_size = 4;
}

// ListComponentRunsRequest is the request message for ListComponentRuns.
message ListComponentRunsRequest {
// The namespace of the pipeline run.
string namespace = 1;

// The unique identifier of the pipeline run to list component runs for.
string pipeline_trigger_uid = 2;

// The page number to retrieve (1-based).
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
int32 page = 3;

// The number of items per page.
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
int32 page_size = 4;
}

// ListComponentRunsResponse is the response message for ListComponentRuns.
message ListComponentRunsResponse {
// The list of component runs.
repeated ComponentRun component_runs = 1;

// The total number of component runs matching the request.
int64 total_count = 2;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// The current page number.
int32 page = 3;

// The number of items per page.
int32 page_size = 4;
}

// FileReference represents metadata for a file.
message FileReference {
// Name of the file.
string name = 1;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Format of the file (e.g., PDF, TXT, JPG).
string type = 2;

// Size of the file in bytes.
int64 size = 3;

// URL of the file (e.g., S3 URL).
string url = 4;
}

// PipelineRun represents a single execution of a pipeline.
message PipelineRun {
// Unique identifier for the pipeline.
string pipeline_uid = 1;

// Unique identifier for each run.
string pipeline_trigger_uid = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use either trigger or run but not both

Suggested change
string pipeline_trigger_uid = 2;
string pipeline_run_uid = 2;

@joremysh not a strong opinion but you called this uid in the model endpoint. I'm fine with either approach but I'd make it consistent across APIs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could update the name in protobuf first and later for those in code that are not related to protogen-go


// Pipeline version used in the run.
string pipeline_version = 3;

// Current status of the run.
PipelineRunStatus status = 4;

// Origin of the run (e.g., Web click, API).
string source = 5;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Time taken to complete the run in nanoseconds.
int64 total_duration = 6;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Identity of the user who initiated the run.
string triggered_by = 7;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Namespace of the pipeline (user or organization).
string namespace = 8;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Input files for the run.
repeated FileReference inputs = 9;

// Output files from the run.
repeated FileReference outputs = 10;

// Snapshot of the pipeline recipe used for this run.
google.protobuf.Struct recipe_snapshot = 11;

// Time when the run was triggered.
google.protobuf.Timestamp triggered_time = 12;

// Time when the run started execution.
google.protobuf.Timestamp started_time = 13;

// Time when the run completed.
google.protobuf.Timestamp completed_time = 14;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Error message if the run failed.
string error_msg = 15;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Credits used of internal accounting metric.
double credits_used = 16;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
}

// ComponentRun represents the execution details of a single component within a pipeline run.
message ComponentRun {
// Links to the parent PipelineRun.
string pipeline_trigger_uid = 1;

// Unique identifier for each pipeline component.
string component_id = 2;

// Completion status of the component.
ComponentRunStatus status = 3;

// Time taken to execute the component in nanoseconds.
int64 total_duration = 4;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved

// Time when the component started execution.
google.protobuf.Timestamp started_time = 5;

// Time when the component finished execution.
google.protobuf.Timestamp completed_time = 6;

// Error message if the component failed.
string error_msg = 7;

// Input files for the component.
repeated FileReference inputs = 8;

// Output files from the component.
repeated FileReference outputs = 9;

// Credits used of internal accounting metric.
double credits_used = 10;
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
}

// PipelineRunStatus represents the possible states of a pipeline run.
enum PipelineRunStatus {
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
// The status is unknown or not set.
PIPELINE_RUN_STATUS_UNSPECIFIED = 0;

// The pipeline run is currently in progress.
PIPELINE_RUN_STATUS_RUNNING = 1;

// The pipeline run has completed successfully.
PIPELINE_RUN_STATUS_COMPLETED = 2;

// The pipeline run has failed.
PIPELINE_RUN_STATUS_FAILED = 3;
}

// ComponentRunStatus represents the possible states of a component run.
enum ComponentRunStatus {
// The status is unknown or not set.
COMPONENT_RUN_STATUS_UNSPECIFIED = 0;

// The component run is currently in progress.
COMPONENT_RUN_STATUS_RUNNING = 1;

// The component run has completed successfully.
COMPONENT_RUN_STATUS_COMPLETED = 2;

// The component run has failed.
COMPONENT_RUN_STATUS_FAILED = 3;
}
15 changes: 15 additions & 0 deletions vdp/pipeline/v1beta/pipeline_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1488,4 +1488,19 @@ service PipelinePublicService {
};
option deprecated = true;
}

// ListPipelineRuns retrieves a paginated list of pipeline runs for a given user and namespace.
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
rpc ListPipelineRuns(ListPipelineRunsRequest) returns (ListPipelineRunsResponse) {
option (google.api.http) = {
get: "/v1beta/{namespace=users/*/namespaces/*}/pipeline-runs"
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tag

Suggested change
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Trigger"}; // TODO rename trigger as Run
};

}

// ListComponentRuns retrieves a paginated list of component runs for a specific pipeline run.
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
rpc ListComponentRuns(ListComponentRunsRequest) returns (ListComponentRunsResponse) {
option (google.api.http) = {
get: "/v1beta/{namespace=users/*/namespaces/*}/pipeline-runs/{pipeline_trigger_uid}/component-runs"
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
};
jvallesm marked this conversation as resolved.
Show resolved Hide resolved
}

}
Loading