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

More documentation on backend API methods #3758

Merged
merged 24 commits into from
Jun 1, 2020

Conversation

jingzhang36
Copy link
Contributor

@jingzhang36 jingzhang36 commented May 13, 2020

  1. The documentation is added as comment to pipeline.proto, experiment.proto, job.proto and run.proto
  2. Only comments are modified in this PR.
  3. The added comments will result in descriptions in the kfp_api_single_file.swagger.json.
  4. Later those descriptions will result in the auto generated online api reference doc (the online doc will be generated in a separate PR since it is in a different repo).

Known issues: swagger generated method description in go_http_client is problematic while the auto-generated method description in the json file and later in the online api reference is fine. An example is in existing method ReportRunMetrics

ReportRunMetrics reports run metrics reports metrics of a run each metric is reported in its own transaction so this API accepts partial failures metric can be uniquely identified by run id node id name duplicate reporting will be ignored by the API first reporting wins

But since the final online api reference is fine, we'll put up with this go_http_client method description.

Fixes #3759

/assign @Bobgy
/cc @chensun

@kubeflow-bot
Copy link

This change is Reviewable

Copy link
Contributor

@Bobgy Bobgy left a comment

Choose a reason for hiding this comment

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

Awesome! This would be such a great UX improvement when reading the documentation.
/lgtm

@@ -114,7 +116,14 @@ message GetExperimentRequest {
}

message ListExperimentsRequest {
// A page token to request the next page of results. The token is acquried
// from the nextPageToken field of the response from the previous
// ListExperiment call.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Shall we also mention it is optional, when passing in an empty page token, we are fetching the first page?

Some wording suggestions:

For example, when you want to fetch page #2 of a list. Pass the token from the `nextPageToken` field of the page #1 ListExperiment response.

/cc @joeliedtke
for review too

Copy link
Contributor

Choose a reason for hiding this comment

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

Note, I think you can wait for a final agreement on the wording, before changing all the similar descriptions.

Copy link
Contributor Author

@jingzhang36 jingzhang36 May 20, 2020

Choose a reason for hiding this comment

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

I added " or can be omitted when fetching the first page."

Comment on lines 125 to 126
// experiments than this number, the response message will contain a valid
// value in the nextPageToken field.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the response message will contain a nextPageToken field you can use to fetch the next page.
WDYT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -171,13 +180,16 @@ message Experiment {
STORAGESTATE_ARCHIVED = 2;
}

// Output. Specify whether this experiment is in archived or available mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: mode -> state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// Delete a pipeline version by pipeline version ID. If the deleted pipeline
// version happens to be the default pipeline version of a certain pipeline,
// the default version of that pipeline will change to the latest pipeline
// version among all the remaining pipeline versions of that pipeline.
Copy link
Contributor

Choose a reason for hiding this comment

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

discussion: what happens when the last version is deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then the pipeline will have no version and default version is None.
We allow pipeline having no pipeline versions under it.
And that's also why we always encourage users to create run from pipeline versions instead of from pipeline.
However, since users am familiar with the previous way of creating run by specify a pipeline, we try to be backward compatible, and use the default pipeline version if users specify pipeline when they should ideally specify a pipeline version.

@jingzhang36
Copy link
Contributor Author

/hold for @joeliedtke to review

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 14, 2020
@jingzhang36
Copy link
Contributor Author

/assign @joeliedtke The comments will end up in our API reference doc on Kubeflow website via API doc auto-generation process. So please take a look.

@joeliedtke
Copy link
Member

/assign @joeliedtke

Copy link
Member

@joeliedtke joeliedtke left a comment

Choose a reason for hiding this comment

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

Looks great, added some suggestions.

rpc GetExperiment(GetExperimentRequest) returns (Experiment) {
option (google.api.http) = {
get: "/apis/v1beta1/experiments/{id}"
};
}

//Find all experiments.
// Find all experiments. Support pagination and sorting on certain fields.
Copy link
Member

Choose a reason for hiding this comment

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

Find -> Finds
Support pagination -> Supports pagination,

Is there a way for users to identify which fields support sorting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the sorting related comment is with the sorting field. E.g.,

string sort_by = 4;

And that will be reflected to the api reference in Kubeflow website like
https://screenshot.googleplex.com/RNY9KKdkwPF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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

//Find a specific experiment by ID.
// Find a specific experiment by ID.
Copy link
Member

Choose a reason for hiding this comment

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

Find -> Finds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -59,43 +59,45 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
};

service ExperimentService {
//Create a new experiment.
// Create a new experiment.
Copy link
Member

Choose a reason for hiding this comment

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

Create -> Creates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

rpc ListExperiment(ListExperimentsRequest) returns (ListExperimentsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/experiments"
};
}

//Delete an experiment.
// Delete an experiment. Runs and jobs inside the experiment will stay. It is
Copy link
Member

Choose a reason for hiding this comment

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

Suggested revision:

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

rpc DeleteExperiment(DeleteExperimentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/apis/v1beta1/experiments/{id}"
};
}

//Archive an experiment.
// Archive an experiment. Runs and jobs inside the experiment will be archived as well.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested revision:

Archives an experiment and the experiment's runs and jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -122,6 +126,7 @@
},
"/apis/v1beta1/pipeline_versions/{version_id}": {
"get": {
"summary": "Get a pipeline version by pipeline version ID.",
Copy link
Member

Choose a reason for hiding this comment

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

Get -> Gets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in proto file

@@ -150,6 +156,7 @@
]
},
"delete": {
"summary": "Delete a pipeline version by pipeline version ID. If the deleted pipeline\nversion happens to be the default pipeline version of a certain pipeline,\nthe default version of that pipeline will change to the latest pipeline\nversion among all the remaining pipeline versions of that pipeline. If\nthere is no remaining pipeline version, that pipeline will have no default\nversion. Examine the run_service_api.ipynb notebook to [learn more about creating a run using a pipeline version](https://github.com/kubeflow/pipelines/blob/master/tools/benchmarks/run_service_api.ipynb)",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested Revision:

Deletes a pipeline version by pipeline version ID. If the deleted pipeline version is the pipeline's default pipeline version, the default version of that pipeline changes to the pipeline's most recent remaining pipeline version. If there are no remaining pipeline versions, that pipeline will not have a default version. Examine the run_service_api.ipynb notebook to [learn more about creating a run using a pipeline version](https://github.com/kubeflow/pipelines/blob/master/tools/benchmarks/run_service_api.ipynb)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in proto file

@@ -260,7 +272,7 @@
]
},
"post": {
"summary": "Add a pipeline.",
"summary": "Create a pipeline.",
Copy link
Member

Choose a reason for hiding this comment

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

Create -> Creates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in proto file

@@ -322,7 +335,7 @@
]
},
"delete": {
"summary": "Delete a pipeline.",
"summary": "Delete a pipeline. All pipeline versions under this pipeline will be deleted as well.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested revision:

Deletes a pipeline and its pipeline versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in proto file

@@ -593,7 +613,8 @@
"type": "object",
"properties": {
"pipeline_url": {
"type": "string"
"type": "string",
"description": "Online storage URL of the file containing the pipeline or pipeline version definition."
Copy link
Member

Choose a reason for hiding this comment

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

Suggested revision:

URL of the pipeline definition or the pipeline version definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. Changed it in the proto.

@jingzhang36
Copy link
Contributor Author

/assign @joeliedtke
Updated according to the comments. @joeliedtke, sorry that I forgot to mention this earlier: you only need to review the changes in .proto files. The other changes will be generated from changed from the .proto files and are identical to those in the .proto files.

Copy link
Member

@joeliedtke joeliedtke left a comment

Choose a reason for hiding this comment

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

This change is looking good. I added a couple suggestions.

@@ -39,7 +39,7 @@ type Client struct {
}

/*
ArchiveExperiment archives an experiment runs and jobs inside the experiment will be archived as well
ArchiveExperiment archives an experiment and the experiment s runs and jobs
Copy link
Member

Choose a reason for hiding this comment

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

experiment s -> experiment's

Please update lines 42, 100, and 187 for the same issue.

Copy link
Contributor Author

@jingzhang36 jingzhang36 May 29, 2020

Choose a reason for hiding this comment

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

The text here in go_http_client directory is auto-generated by the swagger tools. The auto-generation is based on the .proto files, and sometimes the auto-generation will produce something not very readable even the original .proto file has the proper wording.

Moreover, the auto-generated file is in generally not edited manually, since any manual revision to this file will be overridden when the auto-generation process is taking place again.

Therefore, we usually only make sure that the text in .proto files is good for reading. And ignore the text in go_http_client folder.

@@ -126,7 +126,7 @@ func (a *Client) DeletePipeline(params *DeletePipelineParams, authInfo runtime.C
}

/*
DeletePipelineVersion deletes a pipeline version by pipeline version ID if the deleted pipeline version happens to be the default pipeline version of a certain pipeline the default version of that pipeline will change to the latest pipeline version among all the remaining pipeline versions of that pipeline if there is no remaining pipeline version that pipeline will have no default version examine the run service api ipynb notebook to learn more about creating a run using a pipeline version https github com kubeflow pipelines blob master tools benchmarks run service api ipynb
DeletePipelineVersion deletes a pipeline version by pipeline version ID if the deleted pipeline version is the default pipeline version the pipeline s default version changes to the pipeline s most recent pipeline version if there are no remaining pipeline versions the pipeline will have no default version examines the run service api ipynb notebook to learn more about creating a run using a pipeline version https github com kubeflow pipelines blob master tools benchmarks run service api ipynb
Copy link
Member

Choose a reason for hiding this comment

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

pipeline s -> pipeline's

Please update this on line 129 and 216.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason as above.

@@ -242,7 +242,7 @@ func (a *Client) ReportRunMetrics(params *ReportRunMetricsParams, authInfo runti
}

/*
RetryRun res initiate a failed or terminated run
RetryRun res initiates a failed or terminated run
Copy link
Member

Choose a reason for hiding this comment

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

res initiates -> re-initiates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above. And just for the purpose of verification, the text in .proto file is actually correct.

//Re-initiate a failed or terminated run.

We'll just ignore the auto-generated text by swagger tool here.

@joeliedtke
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: joeliedtke
To complete the pull request process, please assign jingzhang36
You can assign the PR to them by writing /assign @jingzhang36 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jingzhang36 jingzhang36 merged commit 2864925 into kubeflow:master Jun 1, 2020
RedbackThomson pushed a commit to RedbackThomson/pipelines that referenced this pull request Jun 17, 2020
* list experiment desc

* changes should be made in proto

* add comments and descriptions

* comments/descriptions in run.proto

* comments in job.proto and pipeline.proto

* try starting a new line

* newline doesnt help

* add swagger gen'ed file

* address comments

* regenerate json and client via swagger

* address comments

* regenerate go_http_client and swagger from proto

* two periods

* re-generate
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
* list experiment desc

* changes should be made in proto

* add comments and descriptions

* comments/descriptions in run.proto

* comments in job.proto and pipeline.proto

* try starting a new line

* newline doesnt help

* add swagger gen'ed file

* address comments

* regenerate json and client via swagger

* address comments

* regenerate go_http_client and swagger from proto

* two periods

* re-generate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More detailed description of backend API methods in API reference
5 participants