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

Add pipeline version api methods #2338

Merged
merged 18 commits into from
Oct 17, 2019
Merged

Conversation

jingzhang36
Copy link
Contributor

@jingzhang36 jingzhang36 commented Oct 9, 2019

  1. add api methods that support pipeline versions.
  2. remove one unused func.

This change is Reviewable

@jingzhang36
Copy link
Contributor Author

/test kubeflow-pipeline-e2e-test

@jingzhang36
Copy link
Contributor Author

/assign @IronPan
/cc @james-jwu

@jingzhang36
Copy link
Contributor Author

/assign @IronPan


rpc ListPipelineVersions(ListPipelineVersionsRequest) returns (ListPipelineVersionsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/pipeline_versions/pipeline/{resource_key.id}"
Copy link
Member

Choose a reason for hiding this comment

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

this URL looks not right. as reference can u check URL to list run by 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.

changed api path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another related api path question. If we merge this PR, users can call api server to directly manipulate (create, delete, get, list) versions in spite that they can't do that from FE. Would that be ok, say, considered as a too-early or premature exposure?

Copy link
Member

Choose a reason for hiding this comment

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

You could, in implementation, return not implemented.

Copy link
Contributor Author

@jingzhang36 jingzhang36 Oct 16, 2019

Choose a reason for hiding this comment

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

ah, I commented out the http point in pipeline.proto, so i can leave the method implementation in its expected final state. BTW, by doing the comment-out, the curl returns "not found".

@@ -25,6 +25,7 @@ import (

const (
DefaultFakeUUID = "123e4567-e89b-12d3-a456-426655440000"
fakeUUIDOne = "123e4567-e89b-12d3-a456-426655440001"
Copy link
Member

Choose a reason for hiding this comment

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

Upper case

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

@@ -814,3 +814,101 @@ func (r *ResourceManager) MarkSampleLoaded() error {
func (r *ResourceManager) getDefaultSA() string {
return common.GetStringConfigWithDefault(defaultPipelineRunnerServiceAccountEnvVar, defaultPipelineRunnerServiceAccount)
}

func (r *ResourceManager) CreatePipelineVersion(apiVersion *api.PipelineVersion, pipelineFile []byte) (*model.PipelineVersion, error) {
// Extract the parameter from the pipeline
Copy link
Member

Choose a reason for hiding this comment

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

parameter -> parameters

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

"Invalid Pipeline URL %v. Please specify a valid URL",
request.Version.PackageUrl.PipelineUrl)
}
pipelineUrl := request.Version.PackageUrl.PipelineUrl
Copy link
Member

Choose a reason for hiding this comment

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

move to line 129

Copy link
Contributor Author

Choose a reason for hiding this comment

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

curious: move before validating the url? logically no issue. but assign to pipelineUrl will be simply a waste, if the later check doesn't pass. so why not assign after two checks have passed?

Copy link
Member

Choose a reason for hiding this comment

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

it's more for code sanity than memory optimization. later doesn't matter too much in this case.

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

if err != nil || resp.StatusCode != http.StatusOK {
return nil, util.NewInternalServerError(err,
`Failed to download the pipeline from %v.
Please double check the URL is valid and can be accessed by the
Copy link
Member

Choose a reason for hiding this comment

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

seems line breaks too eagerly (<80 char) and breaks the sentence
see best practice
https://github.com/golang/go/wiki/CodeReviewComments#line-length

please change other places in the PR too

Copy link
Contributor Author

@jingzhang36 jingzhang36 Oct 15, 2019

Choose a reason for hiding this comment

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

i'll try, but given that the guideline for breaking is basically a break here feeling natural (or unnatural), I am inclined to think that many calls are subjective. E.g., I feel it's easy to read to have each input parameter in a separate line, if they can't fit all in a single line. So I know how many parameters are there in first glimpse, especially there are many of them.

That being said. Back to go style, what I'll do is: if gofmt doesn't break lines I'll never add breaks manually.

Copy link
Member

Choose a reason for hiding this comment

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

here it's breaking in the middle of a sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

pipelineUrl)
}
pipelineFileName := path.Base(pipelineUrl)
pipelineFile, err := ReadPipelineFile(
Copy link
Member

Choose a reason for hiding this comment

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

ditto this is not a natural line break

Copy link
Contributor Author

@jingzhang36 jingzhang36 Oct 15, 2019

Choose a reason for hiding this comment

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

changed

"Parameters": newPipelineVersion.Parameters,
"PipelineId": newPipelineVersion.PipelineId,
"Status": string(newPipelineVersion.Status),
"CodeSourceUrl": ""}).
Copy link
Member

Choose a reason for hiding this comment

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

why empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... Thanks for the catch! Forgot about this place after the initial quick draft. Added unit test including this field.

return nil
}

func (s *PipelineStore) GetPipelineVersion(versionId string) (*model.PipelineVersion, error) {
Copy link
Member

Choose a reason for hiding this comment

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

can you remind me why we need two methods? get and get status

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the latter is used in test to quickly fetch a pipeline (or pipeline version) in certain status? e.g., when testing deletion, db is updated, minio failed; and pipeline in db should be in deleting status. so get pipeline or pipeline version with deleting status to verify.

sql, args, err := sq.
Select(pipelineVersionColumns...).
From("pipeline_versions").
Where(sq.Eq{"UUID": versionId}).
Copy link
Member

Choose a reason for hiding this comment

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

can you use and statement instead of chaining where for better readability

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

@jingzhang36
Copy link
Contributor Author

/assign @IronPan

@jingzhang36
Copy link
Contributor Author

/assign @IronPan

@IronPan
Copy link
Member

IronPan commented Oct 17, 2019

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: IronPan

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

The pull request process is described 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
Copy link
Contributor Author

/test kubeflow-pipeline-sample-test

@k8s-ci-robot k8s-ci-robot merged commit f66af1f into kubeflow:master Oct 17, 2019
magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this pull request Oct 22, 2023
Signed-off-by: Dan Sun <dsun20@bloomberg.net>
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.

3 participants