-
Notifications
You must be signed in to change notification settings - Fork 108
Add support for registered models for direct deployment #3670
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
Changes from all commits
f99564c
6aa0df8
2665367
dc23210
20588ff
6571c00
9df2d08
1e8cf02
c3f24b1
afb8d96
0a91856
cf9c214
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,10 @@ | ||
bundle: | ||
name: deploy-registered-models-basic-$UNIQUE_NAME | ||
|
||
resources: | ||
registered_models: | ||
my_registered_model: | ||
name: $NAME | ||
comment: $COMMENT | ||
catalog_name: $CATALOG_NAME | ||
schema_name: $SCHEMA_NAME |
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,132 @@ | ||
|
||
>>> export NAME=my-registered-model-[UNIQUE_NAME] | ||
|
||
>>> export COMMENT=original comment | ||
|
||
>>> export CATALOG_NAME=main | ||
|
||
>>> export SCHEMA_NAME=default | ||
|
||
=== create catalog and schema to test diff functionality | ||
>>> [CLI] catalogs create mycatalog-[UNIQUE_NAME] | ||
{ | ||
"full_name": "mycatalog-[UNIQUE_NAME]" | ||
} | ||
|
||
>>> [CLI] schemas create myschema-[UNIQUE_NAME] mycatalog-[UNIQUE_NAME] | ||
{ | ||
"full_name": "mycatalog-[UNIQUE_NAME].myschema-[UNIQUE_NAME]" | ||
} | ||
|
||
=== create the registered model | ||
>>> [CLI] bundle plan | ||
create registered_models.my_registered_model | ||
|
||
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged | ||
|
||
>>> [CLI] bundle deploy | ||
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default/files... | ||
Deploying resources... | ||
Updating deployment state... | ||
Deployment complete! | ||
|
||
>>> [CLI] registered-models get main.default.my-registered-model-[UNIQUE_NAME] | ||
{ | ||
"name": "my-registered-model-[UNIQUE_NAME]", | ||
"comment": "original comment", | ||
"catalog_name": "main", | ||
"schema_name": "default" | ||
} | ||
|
||
=== update the comment, this should not recreate | ||
>>> [CLI] bundle plan | ||
update registered_models.my_registered_model | ||
|
||
Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged | ||
|
||
>>> [CLI] bundle deploy | ||
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default/files... | ||
Deploying resources... | ||
Updating deployment state... | ||
Deployment complete! | ||
|
||
>>> [CLI] registered-models get main.default.my-registered-model-[UNIQUE_NAME] | ||
{ | ||
"name": "my-registered-model-[UNIQUE_NAME]", | ||
"comment": "updated comment", | ||
"catalog_name": "main", | ||
"schema_name": "default" | ||
} | ||
|
||
=== update the name, this should recreate | ||
>>> [CLI] bundle plan | ||
recreate registered_models.my_registered_model | ||
|
||
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged | ||
|
||
>>> [CLI] bundle deploy | ||
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default/files... | ||
Deploying resources... | ||
Updating deployment state... | ||
Deployment complete! | ||
|
||
>>> [CLI] registered-models get main.default.my-registered-model-updated-[UNIQUE_NAME] | ||
{ | ||
"name": "my-registered-model-updated-[UNIQUE_NAME]", | ||
"comment": "updated comment", | ||
"catalog_name": "main", | ||
"schema_name": "default" | ||
} | ||
|
||
=== update the catalog name, this should recreate | ||
>>> [CLI] bundle plan | ||
recreate registered_models.my_registered_model | ||
|
||
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged | ||
|
||
>>> [CLI] bundle deploy | ||
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default/files... | ||
Deploying resources... | ||
Updating deployment state... | ||
Deployment complete! | ||
|
||
>>> [CLI] registered-models get mycatalog-[UNIQUE_NAME].default.my-registered-model-updated-[UNIQUE_NAME] | ||
{ | ||
"name": "my-registered-model-updated-[UNIQUE_NAME]", | ||
"comment": "updated comment", | ||
"catalog_name": "mycatalog-[UNIQUE_NAME]", | ||
"schema_name": "default" | ||
} | ||
|
||
=== update the schema name, this should recreate | ||
>>> [CLI] bundle plan | ||
recreate registered_models.my_registered_model | ||
|
||
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged | ||
|
||
>>> [CLI] bundle deploy | ||
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default/files... | ||
Deploying resources... | ||
Updating deployment state... | ||
Deployment complete! | ||
|
||
>>> [CLI] registered-models get mycatalog-[UNIQUE_NAME].myschema-[UNIQUE_NAME].my-registered-model-updated-[UNIQUE_NAME] | ||
{ | ||
"name": "my-registered-model-updated-[UNIQUE_NAME]", | ||
"comment": "updated comment", | ||
"catalog_name": "mycatalog-[UNIQUE_NAME]", | ||
"schema_name": "myschema-[UNIQUE_NAME]" | ||
} | ||
|
||
>>> [CLI] bundle destroy --auto-approve | ||
The following resources will be deleted: | ||
delete registered_model my_registered_model | ||
|
||
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-registered-models-basic-[UNIQUE_NAME]/default | ||
|
||
Deleting files... | ||
Destroy complete! | ||
|
||
>>> [CLI] schemas delete mycatalog-[UNIQUE_NAME].myschema-[UNIQUE_NAME] --force | ||
|
||
>>> [CLI] catalogs delete mycatalog-[UNIQUE_NAME] --force |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
trace export NAME="my-registered-model-$UNIQUE_NAME" | ||
trace export COMMENT="original comment" | ||
trace export CATALOG_NAME="main" | ||
trace export SCHEMA_NAME="default" | ||
envsubst < databricks.yml.tmpl > databricks.yml | ||
|
||
title "create catalog and schema to test diff functionality" | ||
catalog_name="mycatalog-${UNIQUE_NAME}" | ||
schema_name="myschema-${UNIQUE_NAME}" | ||
trace $CLI catalogs create ${catalog_name} | jq '{full_name}' | ||
trace $CLI schemas create ${schema_name} ${catalog_name} | jq '{full_name}' | ||
|
||
cleanup() { | ||
trace $CLI bundle destroy --auto-approve | ||
trace $CLI schemas delete ${catalog_name}.${schema_name} --force | ||
trace $CLI catalogs delete ${catalog_name} --force | ||
} | ||
trap cleanup EXIT | ||
|
||
deploy_registered_model() { | ||
trace $CLI bundle plan | ||
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. recording "bundle debug plan" would be nice as well. 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'll address this in a followup PR. |
||
trace $CLI bundle deploy | ||
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. recording non-GET requests would be useful to ensure terraform and direct implementations match. If there is too much difference in payload, it can either be cleaned up or we can just record paths without the payload. 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'll address this in a followup PR. |
||
registered_model_id=$($CLI bundle summary --output json | jq -r '.resources.registered_models.my_registered_model.id') | ||
trace $CLI registered-models get "${registered_model_id}" | jq '{name, comment, catalog_name, schema_name}' | ||
} | ||
|
||
title "create the registered model" | ||
deploy_registered_model | ||
|
||
export COMMENT="updated comment" | ||
envsubst < databricks.yml.tmpl > databricks.yml | ||
|
||
title "update the comment, this should not recreate" | ||
deploy_registered_model | ||
|
||
export NAME="my-registered-model-updated-$UNIQUE_NAME" | ||
envsubst < databricks.yml.tmpl > databricks.yml | ||
|
||
title "update the name, this should recreate" | ||
deploy_registered_model | ||
|
||
title "update the catalog name, this should recreate" | ||
export CATALOG_NAME="${catalog_name}" | ||
envsubst < databricks.yml.tmpl > databricks.yml | ||
deploy_registered_model | ||
|
||
title "update the schema name, this should recreate" | ||
export SCHEMA_NAME="${schema_name}" | ||
envsubst < databricks.yml.tmpl > databricks.yml | ||
deploy_registered_model |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Cloud = true | ||
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. Appreciate making it both local and integration test, that adds to confidence. |
||
Local = true | ||
RequiresUnityCatalog = true |
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.
As discussed offline, would be great to use acceptance/bundle/resources/<resource_name>/ schema.
bundle/deploy is really focussed on deploy command but we're also interested in plan/json plan/destroy/summary.
another aspect is to use smaller tests which is good for perf and debugging:
See how this test is organized:
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 address this in a followup PR.