diff --git a/bundle/config/mutator/translate_paths_jobs.go b/bundle/config/mutator/translate_paths_jobs.go index 58b5e0fb08..42a4ada4fb 100644 --- a/bundle/config/mutator/translate_paths_jobs.go +++ b/bundle/config/mutator/translate_paths_jobs.go @@ -51,6 +51,11 @@ func rewritePatterns(base dyn.Pattern) []jobRewritePattern { translateNoOp, noSkipRewrite, }, + { + base.Append(dyn.Key("libraries"), dyn.AnyIndex(), dyn.Key("requirements")), + translateFilePath, + noSkipRewrite, + }, } } diff --git a/bundle/config/mutator/translate_paths_test.go b/bundle/config/mutator/translate_paths_test.go index 29afb99725..6baf51b9ff 100644 --- a/bundle/config/mutator/translate_paths_test.go +++ b/bundle/config/mutator/translate_paths_test.go @@ -105,6 +105,7 @@ func TestTranslatePaths(t *testing.T) { touchNotebookFile(t, filepath.Join(dir, "my_pipeline_notebook.py")) touchEmptyFile(t, filepath.Join(dir, "my_python_file.py")) touchEmptyFile(t, filepath.Join(dir, "dist", "task.jar")) + touchEmptyFile(t, filepath.Join(dir, "my_requirements.txt")) b := &bundle.Bundle{ RootPath: dir, @@ -161,6 +162,14 @@ func TestTranslatePaths(t *testing.T) { {Jar: "dbfs:/bundle/dist/task_remote.jar"}, }, }, + { + SparkPythonTask: &jobs.SparkPythonTask{ + PythonFile: "./my_python_file.py", + }, + Libraries: []compute.Library{ + {Requirements: "./my_requirements.txt"}, + }, + }, }, }, }, @@ -241,6 +250,11 @@ func TestTranslatePaths(t *testing.T) { "dbfs:/bundle/dist/task_remote.jar", b.Config.Resources.Jobs["job"].Tasks[6].Libraries[0].Jar, ) + assert.Equal( + t, + "/bundle/my_requirements.txt", + b.Config.Resources.Jobs["job"].Tasks[7].Libraries[0].Requirements, + ) // Assert that the path in the libraries now refer to the artifact. assert.Equal(