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

Added metric name to GetObservationLogRequest #559

Merged
merged 2 commits into from
May 20, 2019
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
2 changes: 1 addition & 1 deletion cmd/manager/v1alpha2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *server) ReportObservationLog(ctx context.Context, in *api_pb.ReportObse

// Get all log of Observations for a Trial.
func (s *server) GetObservationLog(ctx context.Context, in *api_pb.GetObservationLogRequest) (*api_pb.GetObservationLogReply, error) {
ol, err := dbIf.GetObservationLog(in.TrialName, in.StartTime, in.EndTime)
ol, err := dbIf.GetObservationLog(in.TrialName, in.MetricName, in.StartTime, in.EndTime)
return &api_pb.GetObservationLogReply{
ObservationLog: ol,
}, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/manager/v1alpha2/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func TestGetObservationLog(t *testing.T) {
},
}

mockDB.EXPECT().GetObservationLog(req.TrialName, req.StartTime, req.EndTime).Return(obs, nil)
mockDB.EXPECT().GetObservationLog(req.TrialName, req.MetricName, req.StartTime, req.EndTime).Return(obs, nil)
ret, err := s.GetObservationLog(context.Background(), req)
if err != nil {
t.Fatalf("GetObservationLog Error %v", err)
Expand Down
322 changes: 165 additions & 157 deletions pkg/api/v1alpha2/api.pb.go

Large diffs are not rendered by default.

28 changes: 3 additions & 25 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.

8 changes: 5 additions & 3 deletions pkg/api/v1alpha2/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ service Manager {
*/
rpc GetObservationLog(GetObservationLogRequest) returns (GetObservationLogReply){
option (google.api.http) = {
get: "/api/Manager/GetObservationLog/{trial_name}"
post: "/api/Manager/GetObservationLog"
body: "*"
};
};

Expand Down Expand Up @@ -491,8 +492,9 @@ message ReportObservationLogReply {

message GetObservationLogRequest {
string trial_name = 1;
string start_time = 2; ///The start of the time range. RFC3339 format
string end_time = 3; ///The end of the time range. RFC3339 format
string metric_name = 2;
Copy link
Member

Choose a reason for hiding this comment

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

how about s/string metric_name/repeat string metric_name_list to make it more scalable

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we target this enhancement in a separate PR? Currently, controller will need to pass only one metric name which would be the objective metric name.

Copy link
Member

Choose a reason for hiding this comment

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

sure

string start_time = 3; ///The start of the time range. RFC3339 format
string end_time = 4; ///The end of the time range. RFC3339 format
}

message GetObservationLogReply {
Expand Down
41 changes: 24 additions & 17 deletions pkg/api/v1alpha2/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
]
}
},
"/api/Manager/GetObservationLog/{trial_name}": {
"get": {
"/api/Manager/GetObservationLog": {
"post": {
"summary": "*\nGet all log of Observations for a Trial.",
"operationId": "GetObservationLog",
"responses": {
Expand All @@ -146,22 +146,12 @@
},
"parameters": [
{
"name": "trial_name",
"in": "path",
"name": "body",
"in": "body",
"required": true,
"type": "string"
},
{
"name": "start_time",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "end_time",
"in": "query",
"required": false,
"type": "string"
"schema": {
"$ref": "#/definitions/alpha2GetObservationLogRequest"
}
}
],
"tags": [
Expand Down Expand Up @@ -681,6 +671,23 @@
}
}
},
"alpha2GetObservationLogRequest": {
"type": "object",
"properties": {
"trial_name": {
"type": "string"
},
"metric_name": {
"type": "string"
},
"start_time": {
"type": "string"
},
"end_time": {
"type": "string"
}
}
},
"alpha2GetSuggestionsReply": {
"type": "object",
"properties": {
Expand Down
Loading