Skip to content

Commit

Permalink
chore(backend): regenerate v1beta1 api clients (#8403)
Browse files Browse the repository at this point in the history
* add v2 experiment.proto

* regenerate v1beta1 client

* remove api version from combined swagger file

* Revert "regenerate v1beta1 client"

This reverts commit 02769d7.

* regenerate v1beta1 clients

* regenerate python packages without api version

* remove regenerated v1 python packages&change proto

* refactor v1 exp apis and functions

* remove v2 api package and refactor v1 proto

* regenerate v1 go clients

* regenerate v1 python package

* refactor and update the human maintained swagger

* renew swagger file

* regenerate v1 packages

* regenerate v1 python package

* refactor

* regenerate v1 go clients

* regenerate v1 python package

* recover dockerfile and add s in python

* fix func name

* use commit for sdk execution test

* change sdk execution test

* update test script

* add v1 to methods

* proto update v1 method names

* regenerate v1 go packages

* regenerate python client

* update server methods

* refactor

* refactor

* refactor

* refactor python client

* fix get_healthz

* update sample-test.sh in v2 backend

* sample test script

* change v2 sample test

* change package install order

* Revert "change package install order"

This reverts commit c24fcfb.

* use KFP server api from commit for v2 sample tests

* small fix
  • Loading branch information
Linchin authored Nov 10, 2022
1 parent 684779e commit 3f2e20d
Show file tree
Hide file tree
Showing 431 changed files with 13,733 additions and 13,745 deletions.
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ RUN ./hack/install-go-licenses.sh
# First, make sure there's no forbidden license.
RUN go-licenses check ./backend/src/apiserver
RUN go-licenses csv ./backend/src/apiserver > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES
diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES

# 2. Compile preloaded pipeline samples
FROM python:3.7 as compiler
Expand Down
2 changes: 1 addition & 1 deletion backend/api/build_kfp_server_api_python_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ rm -rf "$DIR"

echo "Generating python code from swagger json in $DIR."
java -jar "$codegen_file" generate -g python -t "$CURRENT_DIR/$API_VERSION/python_http_client_template" -i "$swagger_file" -o "$DIR" -c <(echo '{
"packageName": "'"kfp_server_api_$API_VERSION"'",
"packageName": "'"kfp_server_api"'",
"packageVersion": "'"$VERSION"'",
"packageUrl": "https://github.com/kubeflow/pipelines"
}')
Expand Down
11 changes: 6 additions & 5 deletions backend/api/hack/generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rm -f -f backend/api/${API_VERSION}/go_client/*
# Create directories if they don't exist
mkdir -p backend/api/${API_VERSION}/go_http_client
mkdir -p backend/api/${API_VERSION}/go_client
mkdir -p backend/api/${API_VERSION}/swagger

# Generate *.pb.go (grpc api client) from *.proto.
${PROTOCCOMPILER} -I. -Ibackend/api/${API_VERSION} \
Expand Down Expand Up @@ -67,9 +68,9 @@ cp -a ${TMP_OUTPUT}/backend/api/${API_VERSION}/*.swagger.json ./backend/api/${AP
# Generate a single swagger json file from the swagger json files of all models.
# Note: use backend/backend/api/${API_VERSION}/swagger/{run,job,experiment,pipeline,pipeline.upload,healthz}.swagger.json when apt-get can install jq-1.6
jq -s 'reduce .[] as $item ({}; . * $item) | .info.title = "Kubeflow Pipelines API" | .info.description = "This file contains REST API specification for Kubeflow Pipelines. The file is autogenerated from the swagger definition." | .info.version = "'$KFP_VERSION'" | .info.contact = { "name": "google", "email": "[email protected]", "url": "https://www.google.com" } | .info.license = { "name": "Apache 2.0", "url": "https://raw.githubusercontent.com/kubeflow/pipelines/master/LICENSE" }' \
backend/api/${API_VERSION}/swagger/experiment.swagger.json \
backend/api/${API_VERSION}/swagger/run.swagger.json \
backend/api/${API_VERSION}/swagger/job.swagger.json \
backend/api/${API_VERSION}/swagger/experiment.swagger.json \
backend/api/${API_VERSION}/swagger/pipeline.swagger.json \
backend/api/${API_VERSION}/swagger/pipeline.upload.swagger.json \
backend/api/${API_VERSION}/swagger/healthz.swagger.json \
Expand Down Expand Up @@ -126,9 +127,9 @@ swagger generate client \
-t backend/api/${API_VERSION}/go_http_client
# Hack to fix an issue with go-swagger
# See https://github.com/go-swagger/go-swagger/issues/1381 for details.
sed -i -- 's/MaxConcurrency int64 `json:"max_concurrency,omitempty"`/MaxConcurrency int64 `json:"max_concurrency,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/${API_VERSION}_job.go
sed -i -- 's/IntervalSecond int64 `json:"interval_second,omitempty"`/IntervalSecond int64 `json:"interval_second,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/${API_VERSION}_periodic_schedule.go
sed -i -- 's/MaxConcurrency string `json:"max_concurrency,omitempty"`/MaxConcurrency int64 `json:"max_concurrency,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/${API_VERSION}_job.go
sed -i -- 's/IntervalSecond string `json:"interval_second,omitempty"`/IntervalSecond int64 `json:"interval_second,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/${API_VERSION}_periodic_schedule.go
sed -i -- 's/MaxConcurrency int64 `json:"max_concurrency,omitempty"`/MaxConcurrency int64 `json:"max_concurrency,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/api_job.go
sed -i -- 's/IntervalSecond int64 `json:"interval_second,omitempty"`/IntervalSecond int64 `json:"interval_second,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/api_periodic_schedule.go
sed -i -- 's/MaxConcurrency string `json:"max_concurrency,omitempty"`/MaxConcurrency int64 `json:"max_concurrency,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/api_job.go
sed -i -- 's/IntervalSecond string `json:"interval_second,omitempty"`/IntervalSecond int64 `json:"interval_second,omitempty,string"`/g' backend/api/${API_VERSION}/go_http_client/job_model/api_periodic_schedule.go
# Execute the //go:generate directives in the generated code.
cd backend/api && go generate ./...
6 changes: 3 additions & 3 deletions backend/api/v1beta1/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
syntax = "proto3";

option go_package = "github.com/kubeflow/pipelines/backend/api/v1beta1/go_client";
package v1beta1;
package api;

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
Expand All @@ -27,7 +27,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
value: {
schema: {
json_schema: {
ref: ".v1beta1.Status";
ref: ".api.Status";
}
}
}
Expand Down Expand Up @@ -56,7 +56,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
};

service AuthService {
rpc Authorize(AuthorizeRequest) returns (google.protobuf.Empty) {
rpc AuthorizeV1(AuthorizeRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
get: "/apis/v1beta1/auth"
};
Expand Down
2 changes: 1 addition & 1 deletion backend/api/v1beta1/error.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
syntax = "proto3";

option go_package = "github.com/kubeflow/pipelines/backend/api/v1beta1/go_client";
package v1beta1;
package api;

import "google/protobuf/any.proto";

Expand Down
16 changes: 8 additions & 8 deletions backend/api/v1beta1/experiment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
syntax = "proto3";

option go_package = "github.com/kubeflow/pipelines/backend/api/v1beta1/go_client";
package v1beta1;
package api;

import "backend/api/v1beta1/error.proto";
import "backend/api/v1beta1/resource_reference.proto";
Expand All @@ -30,7 +30,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
value: {
schema: {
json_schema: {
ref: ".v1beta1.Status";
ref: ".api.Status";
}
}
}
Expand Down Expand Up @@ -60,22 +60,22 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {

service ExperimentService {
// Creates a new experiment.
rpc CreateExperiment(CreateExperimentRequest) returns (Experiment) {
rpc CreateExperimentV1(CreateExperimentRequest) returns (Experiment) {
option (google.api.http) = {
post: "/apis/v1beta1/experiments"
body: "experiment"
};
}

// Finds a specific experiment by ID.
rpc GetExperiment(GetExperimentRequest) returns (Experiment) {
rpc GetExperimentV1(GetExperimentRequest) returns (Experiment) {
option (google.api.http) = {
get: "/apis/v1beta1/experiments/{id}"
};
}

// Finds all experiments. Supports pagination, and sorting on certain fields.
rpc ListExperiment(ListExperimentsRequest) returns (ListExperimentsResponse) {
rpc ListExperimentsV1(ListExperimentsRequest) returns (ListExperimentsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/experiments"
};
Expand All @@ -84,22 +84,22 @@ service ExperimentService {
// Deletes an experiment without deleting the experiment's runs and jobs. To
// avoid unexpected behaviors, delete an experiment's runs and jobs before
// deleting the experiment.
rpc DeleteExperiment(DeleteExperimentRequest) returns (google.protobuf.Empty) {
rpc DeleteExperimentV1(DeleteExperimentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/apis/v1beta1/experiments/{id}"
};
}

// Archives an experiment and the experiment's runs and jobs.
rpc ArchiveExperiment(ArchiveExperimentRequest) returns (google.protobuf.Empty) {
rpc ArchiveExperimentV1(ArchiveExperimentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/experiments/{id}:archive"
};
}

// Restores an archived experiment. The experiment's archived runs and jobs
// will stay archived.
rpc UnarchiveExperiment(UnarchiveExperimentRequest) returns (google.protobuf.Empty) {
rpc UnarchiveExperimentV1(UnarchiveExperimentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/experiments/{id}:unarchive"
};
Expand Down
2 changes: 1 addition & 1 deletion backend/api/v1beta1/filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
syntax = "proto3";

option go_package = "github.com/kubeflow/pipelines/backend/api/v1beta1/go_client";
package v1beta1;
package api;

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
Expand Down
Loading

0 comments on commit 3f2e20d

Please sign in to comment.