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

Fix Python version #493

Merged
merged 1 commit into from
Jan 14, 2021
Merged
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
8 changes: 5 additions & 3 deletions go/pkg/cli/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ func writeExperimentCommon(au aurora.Aurora, w *tabwriter.Writer, exp *project.E
fmt.Fprintf(w, "%s\t\n", au.Faint("(none)"))
}

fmt.Fprintf(w, "\t\n")
fmt.Fprintf(w, "%s\t\n", au.Bold("System"))
fmt.Fprintf(w, "Python version:\t%s\n", exp.PythonVersion)
if exp.PythonVersion != "" {
fmt.Fprintf(w, "\t\n")
fmt.Fprintf(w, "%s\t\n", au.Bold("System"))
fmt.Fprintf(w, "Python version:\t%s\n", exp.PythonVersion)
}

fmt.Fprintf(w, "\t\n")
fmt.Fprintf(w, "%s\t\n", au.Bold("Python Packages"))
Expand Down
2 changes: 2 additions & 0 deletions go/pkg/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ type CreateExperimentArgs struct {
Command string
Params map[string]param.Value
PythonPackages map[string]string
PythonVersion string
}

func (p *Project) CreateExperiment(args CreateExperimentArgs, async bool, workChan chan func() error, quiet bool) (*Experiment, error) {
Expand Down Expand Up @@ -233,6 +234,7 @@ func (p *Project) CreateExperiment(args CreateExperimentArgs, async bool, workCh
Config: conf,
Command: args.Command,
Path: args.Path,
PythonVersion: args.PythonVersion,
PythonPackages: args.PythonPackages,
ReplicateVersion: global.Version,
}
Expand Down
1 change: 1 addition & 0 deletions go/pkg/shared/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (s *server) CreateExperiment(ctx context.Context, req *servicepb.CreateExpe
Command: pbReqExp.GetCommand(),
Params: valueMapFromPb(pbReqExp.GetParams()),
PythonPackages: pbReqExp.GetPythonPackages(),
PythonVersion: pbReqExp.GetPythonVersion(),
}
proj, err := s.getProject()
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions python/tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def test_init_and_checkpoint(temp_workdir):
metadata = json.load(fh)
assert metadata["id"] == experiment.id
assert metadata["params"] == {"learning_rate": 0.002}
assert metadata["host"] == ""
assert metadata["user"] != ""
# FIXME: this is broken https://github.com/replicate/replicate/issues/492
assert metadata["config"]["repository"].startswith("file://")
assert metadata["command"] != ""
assert metadata["path"] == "."
assert metadata["python_version"] != ""
assert len(metadata["python_packages"]) > 0
assert metadata["replicate_version"] != ""

with tempfile.TemporaryDirectory() as tmpdir:
with tarfile.open(experiment_tar_path) as tar:
Expand Down