Skip to content

Commit

Permalink
Implement GetExperimentInDB (#558)
Browse files Browse the repository at this point in the history
* Implement GetExperimentInDB

* Parse ErrNoRows error

* Fix pod ready condition in test script

* Add PreCheckRegisterExperiment
  • Loading branch information
hougangliu authored and k8s-ci-robot committed May 22, 2019
1 parent 73d940d commit 17dbca3
Show file tree
Hide file tree
Showing 18 changed files with 819 additions and 660 deletions.
8 changes: 8 additions & 0 deletions cmd/manager/v1alpha2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ func (s *server) RegisterExperiment(ctx context.Context, in *api_pb.RegisterExpe
return &api_pb.RegisterExperimentReply{}, err
}

// Register a Experiment to DB.
func (s *server) PreCheckRegisterExperiment(ctx context.Context, in *api_pb.RegisterExperimentRequest) (*api_pb.PreCheckRegisterExperimentReply, error) {
can_register, err := dbIf.PreCheckRegisterExperiment(in.Experiment)
return &api_pb.PreCheckRegisterExperimentReply{
CanRegister: can_register,
}, err
}

// Delete a Experiment from DB by name.
func (s *server) DeleteExperiment(ctx context.Context, in *api_pb.DeleteExperimentRequest) (*api_pb.DeleteExperimentReply, error) {
err := dbIf.DeleteExperiment(in.ExperimentName)
Expand Down
431 changes: 246 additions & 185 deletions pkg/api/v1alpha2/api.pb.go

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions pkg/api/v1alpha2/api.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pkg/api/v1alpha2/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ service Manager {
};
};

/**
* PreCheck to register a Experiment to DB.
*/
rpc PreCheckRegisterExperiment(RegisterExperimentRequest) returns (PreCheckRegisterExperimentReply){
option (google.api.http) = {
post: "/api/Manager/PreCheckRegisterExperiment"
body: "experiment"
};
};


/**
* Delete a Experiment from DB by name.
*/
Expand Down Expand Up @@ -392,6 +403,9 @@ message RegisterExperimentRequest {
message RegisterExperimentReply {
}

message PreCheckRegisterExperimentReply {
bool can_register = 1;
}
message DeleteExperimentRequest {
string experiment_name = 1;
}
Expand Down
36 changes: 36 additions & 0 deletions pkg/api/v1alpha2/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,33 @@
]
}
},
"/api/Manager/PreCheckRegisterExperiment": {
"post": {
"summary": "*\nPreCheck to register a Experiment to DB.",
"operationId": "PreCheckRegisterExperiment",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/alpha2PreCheckRegisterExperimentReply"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/alpha2Experiment"
}
}
],
"tags": [
"Manager"
]
}
},
"/api/Manager/RegisterExperiment": {
"post": {
"summary": "*\nRegister a Experiment to DB.",
Expand Down Expand Up @@ -906,6 +933,15 @@
"default": "UNKNOWN_TYPE",
"description": "*\nTypes of value for HyperParameter."
},
"alpha2PreCheckRegisterExperimentReply": {
"type": "object",
"properties": {
"can_register": {
"type": "boolean",
"format": "boolean"
}
}
},
"alpha2RegisterExperimentReply": {
"type": "object"
},
Expand Down
Loading

0 comments on commit 17dbca3

Please sign in to comment.