-
Notifications
You must be signed in to change notification settings - Fork 150
Support vector search endpoints and indexes in DABs with direct deployment engine #4816
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
base: main
Are you sure you want to change the base?
Changes from all commits
bc2b5f5
d4c3549
4d3ba88
e8c7465
4423e14
076f7a1
3ffeadd
65962b8
872d31e
396e5c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| bundle: | ||
| name: vector-search-$UNIQUE_NAME | ||
|
|
||
| workspace: | ||
| root_path: ~/.bundle/$UNIQUE_NAME | ||
|
|
||
| resources: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a follow up, please add support for permissions for these resources |
||
| vector_search_endpoints: | ||
| test_endpoint: | ||
| name: $ENDPOINT_NAME | ||
| endpoint_type: STANDARD | ||
| vector_search_indexes: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would assume customers want to use JSON data to add it to the index, so we need to likely test and implement this |
||
| test_index: | ||
| name: $INDEX_NAME | ||
| endpoint_name: ${resources.vector_search_endpoints.test_endpoint.name} | ||
| primary_key: my_pkey | ||
| index_type: DELTA_SYNC | ||
| delta_sync_index_spec: | ||
| source_table: my_table | ||
| pipeline_type: TRIGGERED | ||
|
|
||
| targets: | ||
| development: | ||
| default: true | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
|
|
||
| === Deploy bundle with vector search endpoint and index (index depends on endpoint) | ||
| >>> [CLI] bundle plan | ||
| create vector_search_endpoints.test_endpoint | ||
| create vector_search_indexes.test_index | ||
|
|
||
| Plan: 2 to add, 0 to change, 0 to delete, 0 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Assert the endpoint is created | ||
| >>> [CLI] vector-search-endpoints get-endpoint test-vector-search-endpoint-[UNIQUE_NAME] | ||
| { | ||
| "name": "test-vector-search-endpoint-[UNIQUE_NAME]", | ||
| "endpoint_type": "STANDARD" | ||
| } | ||
|
|
||
| === Assert the index is created | ||
| >>> [CLI] vector-search-indexes get-index workspace.default.test_vector_search_index_[UNIQUE_NAME] | ||
| { | ||
| "name": "workspace.default.test_vector_search_index_[UNIQUE_NAME]", | ||
| "endpoint_name": "test-vector-search-endpoint-[UNIQUE_NAME]", | ||
| "index_type": "DELTA_SYNC" | ||
| } | ||
|
|
||
| === Test cleanup | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.vector_search_endpoints.test_endpoint | ||
| delete resources.vector_search_indexes.test_index | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME] | ||
|
|
||
| Deleting files... | ||
| Destroy complete! | ||
|
|
||
| === Assert the endpoint is deleted | ||
| === Assert the index is deleted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| export ENDPOINT_NAME="test-vector-search-endpoint-${UNIQUE_NAME}" | ||
| export INDEX_NAME="workspace.default.test_vector_search_index_${UNIQUE_NAME}" | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| title "Test cleanup" | ||
| trace $CLI bundle destroy --auto-approve | ||
|
|
||
| title "Assert the endpoint is deleted" | ||
| trace errcode $CLI vector-search-endpoints get-endpoint "${ENDPOINT_NAME}" 2>/dev/null | ||
| title "Assert the index is deleted" | ||
| trace errcode $CLI vector-search-indexes get-index "${INDEX_NAME}" 2>/dev/null | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| title "Deploy bundle with vector search endpoint and index (index depends on endpoint)" | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle deploy | ||
|
|
||
| title "Assert the endpoint is created" | ||
| trace $CLI vector-search-endpoints get-endpoint "${ENDPOINT_NAME}" | jq "{name, endpoint_type}" | ||
|
|
||
| title "Assert the index is created" | ||
| trace $CLI vector-search-indexes get-index "${INDEX_NAME}" | jq "{name, endpoint_name, index_type}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Tests endpoint + index with interdependence (index depends on endpoint). | ||
|
|
||
| Local = true | ||
| Cloud = true | ||
| RecordRequests = false | ||
|
|
||
| Ignore = [ | ||
| ".databricks", | ||
| "databricks.yml", | ||
| ] | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package resources | ||
|
|
||
| import ( | ||
| "context" | ||
| "net/url" | ||
|
|
||
| "github.com/databricks/cli/libs/log" | ||
| "github.com/databricks/databricks-sdk-go" | ||
| "github.com/databricks/databricks-sdk-go/apierr" | ||
| "github.com/databricks/databricks-sdk-go/marshal" | ||
| "github.com/databricks/databricks-sdk-go/service/vectorsearch" | ||
| ) | ||
|
|
||
| type VectorSearchEndpoint struct { | ||
| BaseResource | ||
| vectorsearch.CreateEndpoint | ||
| } | ||
|
|
||
| func (e *VectorSearchEndpoint) UnmarshalJSON(b []byte) error { | ||
| return marshal.Unmarshal(b, e) | ||
| } | ||
|
|
||
| func (e VectorSearchEndpoint) MarshalJSON() ([]byte, error) { | ||
| return marshal.Marshal(e) | ||
| } | ||
|
|
||
| func (e *VectorSearchEndpoint) Exists(ctx context.Context, w *databricks.WorkspaceClient, name string) (bool, error) { | ||
| _, err := w.VectorSearchEndpoints.GetEndpoint(ctx, vectorsearch.GetEndpointRequest{ | ||
| EndpointName: name, | ||
| }) | ||
| if err != nil { | ||
| log.Debugf(ctx, "vector search endpoint %s does not exist: %v", name, err) | ||
| if apierr.IsMissing(err) { | ||
| return false, nil | ||
| } | ||
| return false, err | ||
| } | ||
| return true, nil | ||
| } | ||
|
|
||
| func (*VectorSearchEndpoint) ResourceDescription() ResourceDescription { | ||
| return ResourceDescription{ | ||
| SingularName: "vector_search_endpoint", | ||
| PluralName: "vector_search_endpoints", | ||
| SingularTitle: "Vector Search Endpoint", | ||
| PluralTitle: "Vector Search Endpoints", | ||
| } | ||
| } | ||
|
|
||
| func (e *VectorSearchEndpoint) InitializeURL(baseURL url.URL) { | ||
| if e.ID == "" { | ||
| return | ||
| } | ||
| baseURL.Path = "explore/vector-search/" + e.ID | ||
| e.URL = baseURL.String() | ||
| } | ||
|
|
||
| func (e *VectorSearchEndpoint) GetURL() string { | ||
| return e.URL | ||
| } | ||
|
|
||
| func (e *VectorSearchEndpoint) GetName() string { | ||
| return e.Name | ||
| } |
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.
Should we merge budget_policy_id and effective_budget_policy_id? So that we detect drift there? OR are there cases where effective_budget_policy_id is different due to some external policy?