Move trampoline code into trampoline package (#1793)

## Changes

Doing this to make room for PyDABs under `bundle/python`.

## Tests

n/a
This commit is contained in:
Pieter Noordhuis 2024-09-27 11:32:54 +02:00 committed by GitHub
parent a1dca56abf
commit 56cd96cb93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 16 additions and 15 deletions

View File

@ -15,8 +15,8 @@ import (
"github.com/databricks/cli/bundle/deploy/terraform" "github.com/databricks/cli/bundle/deploy/terraform"
"github.com/databricks/cli/bundle/libraries" "github.com/databricks/cli/bundle/libraries"
"github.com/databricks/cli/bundle/permissions" "github.com/databricks/cli/bundle/permissions"
"github.com/databricks/cli/bundle/python"
"github.com/databricks/cli/bundle/scripts" "github.com/databricks/cli/bundle/scripts"
"github.com/databricks/cli/bundle/trampoline"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/sync" "github.com/databricks/cli/libs/sync"
terraformlib "github.com/databricks/cli/libs/terraform" terraformlib "github.com/databricks/cli/libs/terraform"
@ -157,7 +157,7 @@ func Deploy(outputHandler sync.OutputHandler) bundle.Mutator {
artifacts.CleanUp(), artifacts.CleanUp(),
libraries.ExpandGlobReferences(), libraries.ExpandGlobReferences(),
libraries.Upload(), libraries.Upload(),
python.TransformWheelTask(), trampoline.TransformWheelTask(),
files.Upload(outputHandler), files.Upload(outputHandler),
deploy.StateUpdate(), deploy.StateUpdate(),
deploy.StatePush(), deploy.StatePush(),

View File

@ -9,8 +9,8 @@ import (
"github.com/databricks/cli/bundle/deploy/metadata" "github.com/databricks/cli/bundle/deploy/metadata"
"github.com/databricks/cli/bundle/deploy/terraform" "github.com/databricks/cli/bundle/deploy/terraform"
"github.com/databricks/cli/bundle/permissions" "github.com/databricks/cli/bundle/permissions"
"github.com/databricks/cli/bundle/python"
"github.com/databricks/cli/bundle/scripts" "github.com/databricks/cli/bundle/scripts"
"github.com/databricks/cli/bundle/trampoline"
) )
// The initialize phase fills in defaults and connects to the workspace. // The initialize phase fills in defaults and connects to the workspace.
@ -66,7 +66,7 @@ func Initialize() bundle.Mutator {
mutator.ConfigureWSFS(), mutator.ConfigureWSFS(),
mutator.TranslatePaths(), mutator.TranslatePaths(),
python.WrapperWarning(), trampoline.WrapperWarning(),
permissions.ApplyBundlePermissions(), permissions.ApplyBundlePermissions(),
permissions.FilterCurrentUser(), permissions.FilterCurrentUser(),
metadata.AnnotateJobs(), metadata.AnnotateJobs(),

View File

@ -1,4 +1,4 @@
package python package trampoline
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package python package trampoline
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package python package trampoline
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package python package trampoline
import ( import (
"context" "context"
@ -69,7 +69,7 @@ func TransformWheelTask() bundle.Mutator {
res := b.Config.Experimental != nil && b.Config.Experimental.PythonWheelWrapper res := b.Config.Experimental != nil && b.Config.Experimental.PythonWheelWrapper
return res, nil return res, nil
}, },
mutator.NewTrampoline( NewTrampoline(
"python_wheel", "python_wheel",
&pythonTrampoline{}, &pythonTrampoline{},
NOTEBOOK_TEMPLATE, NOTEBOOK_TEMPLATE,
@ -94,9 +94,9 @@ func (t *pythonTrampoline) CleanUp(task *jobs.Task) error {
return nil return nil
} }
func (t *pythonTrampoline) GetTasks(b *bundle.Bundle) []mutator.TaskWithJobKey { func (t *pythonTrampoline) GetTasks(b *bundle.Bundle) []TaskWithJobKey {
r := b.Config.Resources r := b.Config.Resources
result := make([]mutator.TaskWithJobKey, 0) result := make([]TaskWithJobKey, 0)
for k := range b.Config.Resources.Jobs { for k := range b.Config.Resources.Jobs {
tasks := r.Jobs[k].JobSettings.Tasks tasks := r.Jobs[k].JobSettings.Tasks
for i := range tasks { for i := range tasks {
@ -110,7 +110,7 @@ func (t *pythonTrampoline) GetTasks(b *bundle.Bundle) []mutator.TaskWithJobKey {
continue continue
} }
result = append(result, mutator.TaskWithJobKey{ result = append(result, TaskWithJobKey{
JobKey: k, JobKey: k,
Task: task, Task: task,
}) })

View File

@ -1,4 +1,4 @@
package python package trampoline
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package mutator package trampoline
import ( import (
"context" "context"
@ -23,6 +23,7 @@ type TrampolineFunctions interface {
GetTasks(b *bundle.Bundle) []TaskWithJobKey GetTasks(b *bundle.Bundle) []TaskWithJobKey
CleanUp(task *jobs.Task) error CleanUp(task *jobs.Task) error
} }
type trampoline struct { type trampoline struct {
name string name string
functions TrampolineFunctions functions TrampolineFunctions

View File

@ -1,4 +1,4 @@
package mutator package trampoline
import ( import (
"context" "context"