Skip to content
Closed
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
5 changes: 5 additions & 0 deletions bundle/config/mutator/translate_paths_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func rewritePatterns(base dyn.Pattern) []jobRewritePattern {
translateNoOp,
noSkipRewrite,
},
{
base.Append(dyn.Key("libraries"), dyn.AnyIndex(), dyn.Key("requirements")),
translateFilePath,
noSkipRewrite,
},
}
}

Expand Down
14 changes: 14 additions & 0 deletions bundle/config/mutator/translate_paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"},
},
},
},
},
},
Expand Down Expand Up @@ -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(
Expand Down