-
Notifications
You must be signed in to change notification settings - Fork 443
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
Database APIs for NAS #328
Conversation
This PR introduces a distinct set of API functions to save/get NAS jobs into the mysql databases. For now it creates a separate table, but after new update we're gonna use studies table, just increase the number of columns in that one. This one should be merged after: #327. |
pkg/db/db_init.go
Outdated
@@ -15,9 +23,13 @@ func (d *dbConn) DBInit() { | |||
optimization_goal DOUBLE, | |||
parameter_configs TEXT, | |||
tags TEXT, | |||
trials TEXT, |
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 add a timestamp fields to Trial table instead of adding this to Study.
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.
Resolved
pkg/db/interface.go
Outdated
@@ -341,6 +343,201 @@ func (d *dbConn) DeleteStudy(id string) error { | |||
return err | |||
} | |||
|
|||
func (d *dbConn) CreateNAS(in *api.StudyConfig) (string, 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.
The level is different between CreateNAS and CreateStudy. Please change them to an equal level e.g. CreateNASStudy, CreateHPStudy.
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.
Resolved
var configs string | ||
|
||
i := 3 | ||
for 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.
It looks the same process with CreateStudy. Please merge them and split only different process.
/retest |
1 similar comment
/retest |
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.
@@ -119,7 +119,7 @@ func TestGetStudyConfig(t *testing.T) { | |||
mock.ExpectQuery("SELECT").WillReturnRows( | |||
sqlmock.NewRows(studyColumns).AddRow( | |||
"abc", "test", "admin", 1, 0.99, "{}", "", "", "", "test")) | |||
study, err := dbInterface.GetStudyConfig(id) | |||
study, err := dbInterface.GetStudy(id) | |||
if err != nil { |
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.
You should also change this things:
- Add 2 values in StudyColumns:
katib/pkg/db/interface_test.go
Line 23 in 297324d
var studyColumns = []string{ - Add value "time" in trialColumns:
katib/pkg/db/interface_test.go
Line 27 in 297324d
var trialColumns = []string{ - Add 2 empty values:
katib/pkg/db/interface_test.go
Line 119 in 297324d
mock.ExpectQuery("SELECT").WillReturnRows( - Add 1 empty value:
katib/pkg/db/interface_test.go
Line 216 in 297324d
sqlmock.NewRows(trialColumns).AddRow( - Add 2 Values empty values:
katib/pkg/db/interface_test.go
Line 367 in 297324d
studyID, "test", "admin", 1, 0.99, "{}", "", "", "foo,\nbar", "test")) - Add 1 empty value:
katib/pkg/db/interface_test.go
Line 233 in 297324d
rows.AddRow(id, studyID, "", "obj_val", "")
/retest |
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing 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 |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the Googlers can find more info about SignCLA and this PR by following this link. |
/cla yes |
The CLA check is failing because you have multiple commits with different authors. Please rebase and squash the commits so that all your commits are coming from a single author. |
/retest |
@YujiOshima @hougangliu @johnugeorge |
&dummyJobID, | ||
) | ||
var temporaryId string | ||
err := d.db.QueryRow("SELECT id FROM studies WHERE job_id = ?", in.JobId).Scan(&temporaryId) |
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 check sql.ErrNoRows
error instead nil.
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.
Done
&dummyJobID, | ||
) | ||
var temporaryId string | ||
err := d.db.QueryRow("SELECT id FROM studies WHERE job_id = ?", in.JobId).Scan(&temporaryId) |
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 check sql.ErrNoRows
instead of nil check.
cmd/manager/main_test.go
Outdated
) | ||
|
||
func TestCreateStudy(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
defer ctrl.Finish() | ||
mockDB := mockdb.NewMockVizierDBInterface(ctrl) | ||
mockModelStore := mockmodelstore.NewMockModelStore(ctrl) | ||
// Don't need test for Model Store. Right now Katib doesn't use 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.
Removing mockModelStore
test is reasonable but it is not related to this PR. Could you split it to another PR?
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.
Should I split changing version of the cluster (https://github.com/kubeflow/katib/pull/328/files#diff-3d8f11bfc35c15745c970724619c57c3L36) in another PR, as well?
Also, should I delete tests for mockModelStore or just comment it?
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.
changing version of the cluster
Yes, please split it.
mockModelStore
You can delete it.
err := rows.Scan(&trial.TrialId, | ||
&trial.StudyId, | ||
¶meters, | ||
&trial.ObjectiveValue, | ||
&tags, | ||
&timeStamp, |
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.
In other grpc APIs, RFC3339Nano
format is used, not MySQL format.
Please convert timeStamp to the format when returning api.Trial.
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.
Right now, in the Trial API we don't have time field.
https://github.com/kubeflow/katib/blob/master/pkg/api/api.proto#L363
We store it in database, but can't get with grpc APIs.
Should we extend this API with time and add parsing in the separate PR?
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 see.
Yes, please add a timestamp field to grpc API and write doc about the format.
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.
Ok, I will do it in a separate PR.
@Akado2009: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This change is