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 DataPlane API Support #936

Merged
merged 44 commits into from
Jul 5, 2024
Merged

Add DataPlane API Support #936

merged 44 commits into from
Jul 5, 2024

Conversation

hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Jun 3, 2024

Changes

Add DataPlane API Support

Tests

Manual test:

input := []string{}
input = append(input, "Hello, I'm a language model,")
_, err := w.ServingEndpointsDataPlane.Query(context.Background(), serving.QueryEndpointInput{
	Name:   <...>,
	Inputs: input,
})
require.NoError(t, err)
  • make test passing
  • make fmt applied
  • relevant integration tests applied

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 16.74208% with 184 lines in your changes missing coverage. Please review.

Project coverage is 7.09%. Comparing base (d098b1a) to head (c5cfd49).

Files Patch % Lines
...ing/mock_serving_endpoints_data_plane_interface.go 5.81% 81 Missing ⚠️
service/serving/impl.go 0.00% 31 Missing ⚠️
service/catalog/model.go 0.00% 15 Missing ⚠️
service/serving/api.go 0.00% 13 Missing ⚠️
openapi/code/method.go 0.00% 12 Missing ⚠️
httpclient/request.go 0.00% 8 Missing ⚠️
openapi/code/service.go 11.11% 8 Missing ⚠️
httpclient/oauth_token.go 0.00% 6 Missing ⚠️
experimental/mocks/mock_workspace_client.go 16.66% 5 Missing ⚠️
client/client.go 0.00% 4 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #936      +/-   ##
========================================
+ Coverage   7.04%   7.09%   +0.04%     
========================================
  Files        282     284       +2     
  Lines      65329   65542     +213     
========================================
+ Hits        4602    4648      +46     
- Misses     60418   60584     +166     
- Partials     309     310       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

{{.Comment " // " 80}}
{{.Name}} {{.Package.Name}}.{{.Name}}Interface
{{end}}{{end}}
}

// Returns a new OAuth scoped to the authorization details provided.
// It will return an error if the CredentialStrategy does not support OAuth tokens.
//
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need this on the WorkspaceClient, but the Client itself.

@hectorcast-db hectorcast-db marked this pull request as ready for review June 10, 2024 06:58
Copy link
Contributor

@renaudhartert-db renaudhartert-db left a comment

Choose a reason for hiding this comment

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

@hectorcast-db, I left a few Go-style suggestions — please have a look. Happy to discuss these offline.

httpclient/request.go Outdated Show resolved Hide resolved
openapi/code/method.go Outdated Show resolved Hide resolved
service/oauth2/data_plane.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

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

Looking really good! Some feedback but I think we're close to the final cut here.

.codegen/accounts.go.tmpl Outdated Show resolved Hide resolved
.codegen/mock_account_client.go.tmpl Outdated Show resolved Hide resolved
.codegen/workspaces.go.tmpl Outdated Show resolved Hide resolved
openapi/code/service.go Show resolved Hide resolved
return nil, err
}
if response.{{(index .DataPlaneInfoFields 0).PascalName}} == nil {
return nil, errors.New("resource does not support direct Data Plane access")
Copy link
Contributor

Choose a reason for hiding this comment

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

When would this case happen? Is this a bug in the API definition? Or is it possible that some model serving endpoints support direct-to-dataplane access and others don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DataPlane access needs to be enabled on a resource level. If you call this method for a Model which is not "optimized" (their flag for DataPlane), this field won't be set (the endpointURL does not exists)

.codegen/impl.go.tmpl Outdated Show resolved Hide resolved
service/oauth2/data_plane.go Outdated Show resolved Hide resolved
service/oauth2/data_plane.go Show resolved Hide resolved
service/oauth2/data_plane.go Show resolved Hide resolved
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

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

Two small notes, otherwise LGTM!

service/catalog/model.go Outdated Show resolved Hide resolved
.codegen/api.go.tmpl Outdated Show resolved Hide resolved
@hectorcast-db hectorcast-db added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit df99404 Jul 5, 2024
7 checks passed
@hectorcast-db hectorcast-db deleted the dataplane-support branch July 5, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants