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

Database APIs for NAS #328

Closed
wants to merge 29 commits into from
Closed

Database APIs for NAS #328

wants to merge 29 commits into from

Conversation

Akado2009
Copy link
Contributor

@Akado2009 Akado2009 commented Jan 17, 2019

This change is Reviewable

@Akado2009 Akado2009 changed the title Database APIs for NAS WIP: Database APIs for NAS Jan 17, 2019
@Akado2009
Copy link
Contributor Author

Akado2009 commented Jan 17, 2019

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.

@@ -15,9 +23,13 @@ func (d *dbConn) DBInit() {
optimization_goal DOUBLE,
parameter_configs TEXT,
tags TEXT,
trials TEXT,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved

@@ -341,6 +343,201 @@ func (d *dbConn) DeleteStudy(id string) error {
return err
}

func (d *dbConn) CreateNAS(in *api.StudyConfig) (string, error) {
Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

@andreyvelich
Copy link
Member

/retest

1 similar comment
@andreyvelich
Copy link
Member

/retest

Copy link
Member

@andreyvelich andreyvelich left a 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 {
Copy link
Member

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:

  1. Add 2 values in StudyColumns:
    var studyColumns = []string{
  2. Add value "time" in trialColumns:
    var trialColumns = []string{
  3. Add 2 empty values:
    mock.ExpectQuery("SELECT").WillReturnRows(
  4. Add 1 empty value:
    sqlmock.NewRows(trialColumns).AddRow(
  5. Add 2 Values empty values:
    studyID, "test", "admin", 1, 0.99, "{}", "", "", "foo,\nbar", "test"))
  6. Add 1 empty value:
    rows.AddRow(id, studyID, "", "obj_val", "")

@andreyvelich
Copy link
Member

/retest

@k8s-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Feb 16, 2019
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: hougangliu

If they are not already assigned, you can assign the PR to them by writing /assign @hougangliu in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

Googlers can find more info about SignCLA and this PR by following this link.

@andreyvelich
Copy link
Member

/cla yes

@jlewi
Copy link
Contributor

jlewi commented Feb 16, 2019

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.

@andreyvelich
Copy link
Member

/retest

@andreyvelich
Copy link
Member

@YujiOshima @hougangliu @johnugeorge
We finally fixed all presubmit tests.
Can you check, please, all the difference that we made in that PR?

&dummyJobID,
)
var temporaryId string
err := d.db.QueryRow("SELECT id FROM studies WHERE job_id = ?", in.JobId).Scan(&temporaryId)
Copy link
Contributor

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.

Copy link
Member

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)
Copy link
Contributor

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.

)

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.
Copy link
Contributor

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?

Copy link
Member

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?

Copy link
Contributor

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,
&parameters,
&trial.ObjectiveValue,
&tags,
&timeStamp,
Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member

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.

@k8s-ci-robot
Copy link

@Akado2009: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
kubeflow-katib-presubmit 58ad9fc link /test kubeflow-katib-presubmit

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants