Skip to content

Commit

Permalink
Do not wait for app compute to start on bundle deploy (#2144)
Browse files Browse the repository at this point in the history
## Changes
This allows DABs to avoid waiting for the compute to start when app is
initially created as part of "bundle deploy" which significantly
improves deploy time.

Always set no_compute to true for apps

## Tests
Covered by `TestDeployBundleWithApp`, currently fails until TF provider
is upgraded to the version supporting `no_compute` option
  • Loading branch information
andrewnester authored Jan 28, 2025
1 parent 099e9be commit 413ca5c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 37 deletions.
29 changes: 0 additions & 29 deletions bundle/apps/slow_deploy_message.go

This file was deleted.

6 changes: 6 additions & 0 deletions bundle/deploy/terraform/tfdyn/convert_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func (appConverter) Convert(ctx context.Context, key string, vin dyn.Value, out
return err
}

// We always set no_compute to true as it allows DABs not to wait for app compute to be started when app is created.
vout, err = dyn.Set(vout, "no_compute", dyn.V(true))
if err != nil {
return err
}

// Add the converted resource to the output.
out.App[key] = vout.AsAny()

Expand Down
2 changes: 2 additions & 0 deletions bundle/deploy/terraform/tfdyn/convert_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestConvertApp(t *testing.T) {
assert.Equal(t, map[string]any{
"description": "app description",
"name": "app_id",
"no_compute": true,
"resources": []any{
map[string]any{
"name": "job1",
Expand Down Expand Up @@ -136,6 +137,7 @@ func TestConvertAppWithNoDescription(t *testing.T) {
assert.Equal(t, map[string]any{
"name": "app_id",
"description": "", // Due to Apps API always returning a description field, we set it in the output as well to avoid permanent TF drift
"no_compute": true,
"resources": []any{
map[string]any{
"name": "job1",
Expand Down
1 change: 0 additions & 1 deletion bundle/phases/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func Deploy(outputHandler sync.OutputHandler) bundle.Mutator {
// mutators need informed consent if they are potentially destructive.
deployCore := bundle.Defer(
bundle.Seq(
apps.SlowDeployMessage(),
bundle.LogString("Deploying resources..."),
terraform.Apply(),
),
Expand Down
11 changes: 5 additions & 6 deletions integration/bundle/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ import (
func TestDeployBundleWithApp(t *testing.T) {
ctx, wt := acc.WorkspaceTest(t)

// TODO: should only skip app run when app can be created with no_compute option.
if testing.Short() {
t.Log("Skip the app creation and run in short mode")
return
}

if testutil.GetCloud(t) == testutil.GCP {
t.Skip("Skipping test for GCP cloud because /api/2.0/apps is temporarily unavailable there.")
}
Expand Down Expand Up @@ -106,6 +100,11 @@ env:
- name: JOB_ID
value: "%d"`, job.JobId))

if testing.Short() {
t.Log("Skip the app run in short mode")
return
}

// Try to run the app
_, out := runResourceWithStderr(t, ctx, root, "test_app")
require.Contains(t, out, app.Url)
Expand Down
1 change: 0 additions & 1 deletion integration/bundle/testdata/apps/bundle_deploy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Uploading bundle files to /Workspace/Users/$USERNAME/.bundle/$UNIQUE_PRJ/files...
Note: Databricks apps included in this bundle may increase initial deployment time due to compute provisioning.
Deploying resources...
Updating deployment state...
Deployment complete!

0 comments on commit 413ca5c

Please sign in to comment.