Skip to content

Commit

Permalink
fix: Handle subdirs in expconf model_def with Launcher [FOUNDENG-479] (
Browse files Browse the repository at this point in the history
…#709)

If a model_def directory contained a subdir, it was incorrectly treated
as needing a softlink (but that is needed only for the top-level
child dirs of /run/determined) which causes a failure in the launcher
when trying to expand the archive.  Only convert top-level paths
under /run/determined to softlinks.
  • Loading branch information
jerryharrow authored and hanyucui committed May 31, 2023
1 parent 613cd74 commit 2525c00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions master/pkg/tasks/dispatcher_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,16 @@ func generateRunDeterminedLinkNames(
// Not the toplevel runDir, but is under it
if strings.HasPrefix(filePath, RunDir) && filePath != RunDir {
contained := strings.TrimPrefix(strings.TrimPrefix(filePath, RunDir), "/")
// If not a file, then extract the directory name
// If not a file, then extract the top-level directory name
if filepath.Base(contained) != contained {
dir, _ := filepath.Split(contained)
contained = filepath.Dir(dir)
}
linksSet[contained] = true
// links are only created for top-level directories under /run/determined
// If this is a file in a subdir, it will use the parent dir link
if !strings.Contains(contained, "/") {
linksSet[contained] = true
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions master/pkg/tasks/dispatcher_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ func Test_generateRunDeterminedLinkNames(t *testing.T) {
archive.Item{
Path: "/run/determined/xyz/abc.txt",
},
archive.Item{
Path: "/run/determined/xyz/subdir/abc.txt",
},
},
},
}
Expand Down

0 comments on commit 2525c00

Please sign in to comment.