diff --git a/bundle/python/conditional_transform_test.go b/bundle/python/conditional_transform_test.go index 5bf337216c..4c7cad5c56 100644 --- a/bundle/python/conditional_transform_test.go +++ b/bundle/python/conditional_transform_test.go @@ -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"}, }, }, }, @@ -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) } diff --git a/bundle/python/transform.go b/bundle/python/transform.go index a3fea2e878..728d4e83df 100644 --- a/bundle/python/transform.go +++ b/bundle/python/transform.go @@ -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" ) @@ -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 } @@ -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, }