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

Url and Address Url set in TrainedModel Status using InferenceService Status #1319

Merged
merged 11 commits into from Jan 29, 2021

Conversation

abchoo
Copy link
Contributor

@abchoo abchoo commented Jan 26, 2021

What this PR does / why we need it: Included url and addressable url in TrainedModel from parent inference service. Test are added to confirm proper updates.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1007

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

None

@aws-kf-ci-bot
Copy link
Contributor

Hi @abchoo. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abchoo abchoo changed the title Trainedurl Url and Address Url set in TrainedModel Status using InferenceService Status Jan 26, 2021
if err := r.Get(context.TODO(), types.NamespacedName{Namespace: req.Namespace, Name: desiredModel.Spec.InferenceService}, isvc); err != nil {
if errors.IsNotFound(err) {
log.Info("Parent InferenceService does not exists, deleting TrainedModel", "TrainedModel", desiredModel.Name, "InferenceService", isvc.Name)
r.Delete(context.TODO(), desiredModel)
Copy link
Member

Choose a reason for hiding this comment

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

I think we shouldn't delete trained model here, instead we can return error back and the next reconciliation loop will retry.

// Check if parent inference service has the status URL
if isvc.Status.URL != nil {
// Update status to contain the isvc URL with /v1/models/trained-model-name:predict appened
url := isvc.Status.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + ":predict"
Copy link
Member

Choose a reason for hiding this comment

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

for v2 the verb is /infer

if isvc.Status.Address != nil {
if isvc.Status.Address.URL != nil {
////Update status to contain the isvc address with /v1/models/trained-model-name:predict appened
url := isvc.Status.Address.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + ":predict"
Copy link
Member

Choose a reason for hiding this comment

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

/infer for v2 protocol

duckv1 "knative.dev/pkg/apis/duck/v1"
)

// TrainedModelStatus defines the observed state of TrainedModel
type TrainedModelStatus struct {
// Conditions for trained model
duckv1.Status `json:",inline"`
// URL holds the url that will distribute traffic over the provided traffic targets.
// http[s]://{route-name}.{route-namespace}.{cluster-level-suffix}/v1/models/<trainedmodel>:predict
Copy link
Contributor

Choose a reason for hiding this comment

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

For v2 it should be http[s]://{route-name}.{route-namespace}.{cluster-level-suffix}/v2/models/:infer

@yuzliu
Copy link
Contributor

yuzliu commented Jan 27, 2021

I think we can update the e2e test's predict function here to take trainedmodel as an input and resolve the url then send a request. WDYT @yuzisun ?

Comment on lines 147 to 156
// V1 ends with :predict whereas V2 ends with /infer
endpointSuffix := ":predict"
if protocolVersion == string(constants.ProtocolV2) {
endpointSuffix = "/infer"
}

// Check if parent inference service has the status URL
if isvc.Status.URL != nil {
// Update status to contain the isvc URL with /v1/models/trained-model-name:predict appened
url := isvc.Status.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + endpointSuffix
Copy link
Member

Choose a reason for hiding this comment

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

We can use this utility to construct the predict path.

@yuzliu
Copy link
Contributor

yuzliu commented Jan 29, 2021

/LGTM

@yuzisun
Copy link
Member

yuzisun commented Jan 29, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abchoo, yuzisun

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

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.

Propagate status object for TrainedModel
5 participants