-
Notifications
You must be signed in to change notification settings - Fork 460
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
Add Model Management API #48
Conversation
Signed-off-by: YujiOshima <[email protected]>
Signed-off-by: YujiOshima <[email protected]>
/cc @gaocegege @ddysher |
@gaocegege I worry about this PR is too big to review.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM. I agree that we could change the code iteratively and no need to implement cli in this PR.
manager/main.go
Outdated
"google.golang.org/grpc" | ||
"google.golang.org/grpc/reflection" | ||
|
||
pb "github.com/kubeflow/hp-tuning/api" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we group the deps in order?
e.g.
built-in dep
third party
github.com/kubeflow/hp-tuning
manager/main.go
Outdated
@@ -109,6 +68,7 @@ func (s *server) trialIteration(conf *pb.StudyConfig, study_id string, sCh study | |||
ei = defaultEarlyStopInterval | |||
} | |||
estm := time.NewTimer(time.Duration(ei) * time.Second) | |||
strtm := time.NewTimer(time.Duration(30) * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we define 30 as a constant.
} | ||
|
||
func (m *ModelDBInterface) GetStoredModel(in *api.GetStoredModelRequest) (*api.ModelInfo, error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the new line here.
return nil | ||
} | ||
|
||
//func main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the function if it is not used?
@@ -0,0 +1,13 @@ | |||
package modelstore_interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could name it as interface and name the package modelstore_interface
to modelstore
, WDYT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
manager/modelstore_interface/modelstore_interface.go
-> manager/modelstore/interface.go
@@ -10,7 +10,7 @@ import ( | |||
dclient "github.com/docker/docker/client" | |||
"github.com/kubeflow/hp-tuning/api" | |||
"github.com/kubeflow/hp-tuning/db" | |||
"github.com/kubeflow/hp-tuning/manager/modeldb" | |||
// "github.com/kubeflow/hp-tuning/manager/modeldb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the dep?
et, _ := time.Parse(time.RFC3339, t.EvalLogs[len(t.EvalLogs)-1].Time) | ||
mr.Metrics["time-cost-Min"] = et.Sub(st).Minutes() | ||
mif.SendReq(mr) | ||
// mif := modeldb.ModelDbIF{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the code directly?
Signed-off-by: YujiOshima <[email protected]>
@gaocegege Thank you for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, only nits.
manager/main.go
Outdated
@@ -154,7 +153,7 @@ func (s *server) trialIteration(conf *pb.StudyConfig, study_id string, sCh study | |||
} | |||
} | |||
} | |||
strtm.Reset(30 * time.Second) | |||
strtm.Reset(time.Duration(defaultStoreInterval) * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use defaultStoreInterval directly here.
Signed-off-by: YujiOshima <[email protected]>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gaocegege The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for your great work haha |
@@ -12,6 +12,11 @@ service Manager { | |||
rpc GetObjectValue(GetObjectValueRequest) returns (GetObjectValueReply); | |||
rpc AddMeasurementToTrials(AddMeasurementToTrialsRequest) returns (AddMeasurementToTrialsReply); | |||
rpc InitializeSuggestService(InitializeSuggestServiceRequest) returns(InitializeSuggestServiceReply); | |||
rpc StoreStudy(StoreStudyRequest) returns(StoreStudyReply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we change Store
to Save
, i.e. SaveStudy, SaveModel, GetSavedStudies, GetSavedModels, etc.
IMO, word store
is mostly used as a noun (e.g. StoreInterface),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
@@ -214,6 +219,65 @@ message AddMeasurementToTrialsRequest { | |||
message AddMeasurementToTrialsReply { | |||
} | |||
|
|||
message StudyOverView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/OverView/Overview?
@@ -214,6 +219,65 @@ message AddMeasurementToTrialsRequest { | |||
message AddMeasurementToTrialsReply { | |||
} | |||
|
|||
message StudyOverView { | |||
string name = 1; | |||
string author = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
author or owner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will unify owner.
} | ||
|
||
message DataSetInfo { | ||
string Name = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this capitalized while others are not?
@@ -12,6 +12,11 @@ service Manager { | |||
rpc GetObjectValue(GetObjectValueRequest) returns (GetObjectValueReply); | |||
rpc AddMeasurementToTrials(AddMeasurementToTrialsRequest) returns (AddMeasurementToTrialsReply); | |||
rpc InitializeSuggestService(InitializeSuggestServiceRequest) returns(InitializeSuggestServiceReply); | |||
rpc StoreStudy(StoreStudyRequest) returns(StoreStudyReply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little confused here, why do we need to add StoreStudy API here if the PR is about model management API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ModelDB has two concepts, Project and Model.
You need to create a Project before to save Models.
A Study in Katib is mapped to a Project.
A Trial in Katib is mapped to a Model.
isin := false | ||
for _, m := range ret.Models { | ||
if m.TrialId == tid { | ||
isin = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we break early here, since you already set isin
to true, there is no need to loop through all models.
BTW, what is the mapping between model and trail, is it 1:1 mapping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the model is 1:1 mapping to a trial.
The trial is a set of hyperparameters.
} | ||
} | ||
met := make([]*pb.Metrics, len(conf.Metrics)) | ||
for i, mn := range conf.Metrics { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not put this into isin
if block? if isin
is false, then operation here is basically no-op.
@@ -0,0 +1,13 @@ | |||
package modelstore_interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
manager/modelstore_interface/modelstore_interface.go
-> manager/modelstore/interface.go
return &ModelDBInterface{host: host, port: port} | ||
} | ||
|
||
func (m *ModelDBInterface) createSocket() (thrift.TTransport, *modeldb.ModelDBServiceClient, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does model db only supports thrift? Maintaining two messaging format sounds like a painful task ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, ModelDB is only supporting Thrift..
|
||
} | ||
|
||
func (m *ModelDBInterface) StoreModel(in *api.StoreModelRequest) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add documentation for exported methods :)
@YujiOshima @gaocegege looks like there's a race condition :) Can you take a look at the comments even though it's merged? |
@ddysher Thank you for comment. |
Close #43
Add Model Management API. Katib will provide store, update Model Info in ModelDB.