Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: only copy current harness version to trial [DET-3681] #952

Merged
merged 2 commits into from
Jul 27, 2020
Merged
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
8 changes: 6 additions & 2 deletions master/pkg/tasks/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tasks

import (
"archive/tar"
"fmt"
"io/ioutil"
"os"
"path/filepath"
Expand All @@ -11,6 +12,7 @@ import (
"github.com/determined-ai/determined/master/pkg/archive"
"github.com/determined-ai/determined/master/pkg/container"
"github.com/determined-ai/determined/master/pkg/model"
"github.com/determined-ai/determined/master/version"
)

const (
Expand All @@ -22,9 +24,11 @@ const (

func harnessArchive(harnessPath string, aug *model.AgentUserGroup) container.RunArchive {
var harnessFiles archive.Archive
wheelPaths, err := filepath.Glob(filepath.Join(harnessPath, "*.whl"))
validWhlNames := fmt.Sprintf("*%s*.whl", version.Version)
wheelPaths, err := filepath.Glob(filepath.Join(harnessPath, validWhlNames))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect the wheelPaths to be predictable / something we should check?

Copy link
Contributor Author

@stoksc stoksc Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, it should always be $(ROOT)/wheels/determined*$(VERSION)*.whl where ROOT is root from master.yml and version is the version that is set by ldflags flag to go build when we build the master. Based on that, I guess this filepath.Glob could be even more specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The names themselves are standardized by the PEP for whl's, https://www.python.org/dev/peps/pep-0427/#file-name-convention. (I didn't know this, was curious)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean len(wheelPaths) -- i.e., do we expect to find exactly 1 and should we check for that?

Copy link
Contributor Author

@stoksc stoksc Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it should always be 3 (since determined, determined-cli and determined-common should be in $ROOT/wheels).

if err != nil {
panic(errors.Wrapf(err, "error finding Python wheel files in path: %s", harnessPath))
panic(errors.Wrapf(err, "error finding Python wheel files for version %s in path: %s",
version.Version, harnessPath))
}
for _, path := range wheelPaths {
info, err := os.Stat(path)
Expand Down