Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bundle/python/conditional_transform_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,7 @@ func TestTransformWithExperimentalSettingSetToTrue(t *testing.T) {
},
Libraries: []compute.Library{
{Whl: "/Workspace/Users/test@test.com/bundle/dist/test.whl"},
{Jar: "/Workspace/Users/test@test.com/bundle/dist/test.jar"},
},
},
},
Expand DownExpand Up@@ -110,5 +111,6 @@ func TestTransformWithExperimentalSettingSetToTrue(t *testing.T) {

require.Equal(t, path.Join(filepath.ToSlash(internalDirRel), "notebook_job1_key1"), task.NotebookTask.NotebookPath)

require.Empty(t, task.Libraries)
require.Len(t, task.Libraries, 1)
require.Equal(t, "/Workspace/Users/test@test.com/bundle/dist/test.jar", task.Libraries[0].Jar)
}
19 changes: 17 additions & 2 deletions bundle/python/transform.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/config/mutator"
"github.com/databricks/cli/bundle/libraries"
"github.com/databricks/databricks-sdk-go/service/compute"
"github.com/databricks/databricks-sdk-go/service/jobs"
)

Expand DownExpand Up@@ -79,7 +80,14 @@ type pythonTrampoline struct{}

func (t *pythonTrampoline) CleanUp(task *jobs.Task) error {
task.PythonWheelTask = nil
task.Libraries = nil

nonWheelLibraries := make([]compute.Library, 0)
for _, l := range task.Libraries {
if l.Whl == "" {
nonWheelLibraries = append(nonWheelLibraries, l)
}
}
task.Libraries = nonWheelLibraries

return nil
}
Expand DownExpand Up@@ -115,12 +123,19 @@ func needsTrampoline(task *jobs.Task) bool {

func (t *pythonTrampoline) GetTemplateData(task *jobs.Task) (map[string]any, error) {
params, err := t.generateParameters(task.PythonWheelTask)
whlLibraries := make([]compute.Library, 0)
for _, l := range task.Libraries {
if l.Whl != "" {
whlLibraries = append(whlLibraries, l)
}
}

if err != nil {
return nil, err
}

data := map[string]any{
"Libraries": task.Libraries,
"Libraries": whlLibraries,
"Params": params,
"Task": task.PythonWheelTask,
}
Expand Down