-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
/test kubeflow-pipeline-e2e-test |
/assign @IronPan |
/assign @IronPan |
backend/api/pipeline.proto
Outdated
|
||
rpc ListPipelineVersions(ListPipelineVersionsRequest) returns (ListPipelineVersionsResponse) { | ||
option (google.api.http) = { | ||
get: "/apis/v1beta1/pipeline_versions/pipeline/{resource_key.id}" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed api path
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upper case
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter -> parameters
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to line 129
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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": ""}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why empty string?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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}). |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/assign @IronPan |
/assign @IronPan |
/lgtm |
[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 |
/test kubeflow-pipeline-sample-test |
Signed-off-by: Dan Sun <dsun20@bloomberg.net>
This change is