Skip to content

Commit

Permalink
add bestTrialId to statusJob status (#312)
Browse files Browse the repository at this point in the history
* add bestTrialId to statusJob status

* generate mock and add bestworkerid
  • Loading branch information
hougangliu authored and k8s-ci-robot committed Jan 3, 2019
1 parent f24889c commit fae6aa5
Show file tree
Hide file tree
Showing 14 changed files with 923 additions and 458 deletions.
5 changes: 5 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (s *server) GetTrials(ctx context.Context, in *api_pb.GetTrialsRequest) (*a
return &api_pb.GetTrialsReply{Trials: tl}, err
}

func (s *server) GetTrial(ctx context.Context, in *api_pb.GetTrialRequest) (*api_pb.GetTrialReply, error) {
t, err := dbIf.GetTrial(in.TrialId)
return &api_pb.GetTrialReply{Trial: t}, err
}

func (s *server) GetSuggestions(ctx context.Context, in *api_pb.GetSuggestionsRequest) (*api_pb.GetSuggestionsReply, error) {
if in.SuggestionAlgorithm == "" {
return &api_pb.GetSuggestionsReply{Trials: []*api_pb.Trial{}}, errors.New("No suggest algorithm specified")
Expand Down
558 changes: 319 additions & 239 deletions pkg/api/api.pb.go

Large diffs are not rendered by default.

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

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

22 changes: 22 additions & 0 deletions pkg/api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ service Manager {
get: "/api/Manager/GetTrials/{study_id}"
};
};
/**
* Get a Trial Configuration from DB by ID of Trial.
*/
rpc GetTrial(GetTrialRequest) returns (GetTrialReply){
option (google.api.http) = {
get: "/api/Manager/GetTrial/{trial_id}"
};
};
/**
* Create a Worker from Worker Config.
* Generate a unique ID and store the Worker to DB.
Expand Down Expand Up @@ -460,6 +468,20 @@ message GetTrialsReply {
repeated Trial trials = 1;
}

/**
* Get a trial configuration from DB by trial ID
*/
message GetTrialRequest {
string trial_id = 1;
}

/**
* Return a trial configuration by specified trial ID
*/
message GetTrialReply {
Trial trial = 1;
}

/**
* Create a Worker from Worker Config.
* Generate an unique ID and store the Worker to DB.
Expand Down
48 changes: 41 additions & 7 deletions pkg/api/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,31 @@
]
}
},
"/api/Manager/GetTrial/{trial_id}": {
"get": {
"summary": "*\nGet a Trial Configuration from DB by ID of Trial.",
"operationId": "GetTrial",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/apiGetTrialReply"
}
}
},
"parameters": [
{
"name": "trial_id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Manager"
]
}
},
"/api/Manager/GetTrials/GetShouldStopWorkers": {
"post": {
"operationId": "GetShouldStopWorkers",
Expand Down Expand Up @@ -356,7 +381,7 @@
},
"/api/Manager/GetWorkerFullInfo": {
"get": {
"summary": "* \nGet a full informations related to specified Workers.\nIt includes Worker Config, HyperParameters and Metrics Logs.",
"summary": "* \nGet full information related to specified Workers.\nIt includes Worker Config, HyperParameters and Metrics Logs.",
"operationId": "GetWorkerFullInfo",
"responses": {
"200": {
Expand Down Expand Up @@ -400,7 +425,7 @@
},
"/api/Manager/GetWorkers": {
"get": {
"summary": "* \nGet a Worker Configs and Statuses from DB by ID of Study, Trial or Worker.",
"summary": "* \nGet a Worker Configs and Status from DB by ID of Study, Trial or Worker.",
"operationId": "GetWorkers",
"responses": {
"200": {
Expand Down Expand Up @@ -569,7 +594,7 @@
},
"/api/Manager/SetSuggestionParameters": {
"post": {
"summary": "*\nCreate or Update parameter set for a suggestion service.\nWhen you specified a ID of parameter set, it will update the parameter set by your request.\nWhen you specified no ID, it will create a new parameter set for corresponding study and suggestion service.\nThe parameters are key-value format.",
"summary": "*\nCreate or Update parameter set for a suggestion service.\nIf you specify an ID of parameter set, it will update the parameter set by your request.\nIf you don't specify an ID, it will create a new parameter set for corresponding study and suggestion service.\nThe parameters are key-value format.",
"operationId": "SetSuggestionParameters",
"responses": {
"200": {
Expand Down Expand Up @@ -674,7 +699,7 @@
"type": "string"
}
},
"description": "*\nParameter for EarlyStopping service. Key value format."
"description": "*\nParameter for EarlyStopping service. Key-value format."
},
"apiEarlyStoppingParameterSet": {
"type": "object",
Expand Down Expand Up @@ -889,6 +914,15 @@
}
}
},
"apiGetTrialReply": {
"type": "object",
"properties": {
"trial": {
"$ref": "#/definitions/apiTrial"
}
},
"title": "*\nReturn a trial configuration by specified trial ID"
},
"apiGetTrialsReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1262,7 +1296,7 @@
"type": "string"
}
},
"description": "*\nParameter for Suggestion service. Key value format."
"description": "*\nParameter for Suggestion service. Key-value format."
},
"apiSuggestionParameterSet": {
"type": "object",
Expand Down Expand Up @@ -1291,7 +1325,7 @@
"type": "string"
}
},
"description": "*\nTag for each resources."
"description": "*\nTag for each resource."
},
"apiTrial": {
"type": "object",
Expand All @@ -1318,7 +1352,7 @@
}
}
},
"description": "*\nA set of Hyperparameter.\nIn a study, multiple trials are evaluated by worker.\nSuggestion service will generate next trials."
"description": "*\nA set of Hyperparameter.\nIn a study, multiple trials are evaluated by workers.\nSuggestion service will generate next trials."
},
"apiUpdateWorkerStateReply": {
"type": "object"
Expand Down
57 changes: 45 additions & 12 deletions pkg/api/gen-doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
- [GetSuggestionParametersRequest](#api.GetSuggestionParametersRequest)
- [GetSuggestionsReply](#api.GetSuggestionsReply)
- [GetSuggestionsRequest](#api.GetSuggestionsRequest)
- [GetTrialReply](#api.GetTrialReply)
- [GetTrialRequest](#api.GetTrialRequest)
- [GetTrialsReply](#api.GetTrialsReply)
- [GetTrialsRequest](#api.GetTrialsRequest)
- [GetWorkerFullInfoReply](#api.GetWorkerFullInfoReply)
Expand Down Expand Up @@ -117,7 +119,7 @@ Return generated StudyID.

### CreateStudyRequest
Create a Study from Study Config.
Generate a unique ID and store the Study to DB.
Generate an unique ID and store the Study to DB.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -148,7 +150,7 @@ Return generated TrialID.

### CreateTrialRequest
Create a Trial from Trial Config.
Generate a unique ID and store the Trial to DB.
Generate an unique ID and store the Trial to DB.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -179,7 +181,7 @@ Generate a unique ID and store the Trial to DB.
<a name="api.EarlyStoppingParameter"/>

### EarlyStoppingParameter
Parameter for EarlyStopping service. Key value format.
Parameter for EarlyStopping service. Key-value format.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -587,6 +589,36 @@ Get a Study Config from DB by ID of Study.



<a name="api.GetTrialReply"/>

### GetTrialReply
Return a trial configuration by specified trial ID


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| trial | [Trial](#api.Trial) | | |






<a name="api.GetTrialRequest"/>

### GetTrialRequest
Get a trial configuration from DB by trial ID


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| trial_id | [string](#string) | | |






<a name="api.GetTrialsReply"/>

### GetTrialsReply
Expand Down Expand Up @@ -635,7 +667,7 @@ Get a Trial Configs from DB by ID of Study.
<a name="api.GetWorkerFullInfoRequest"/>

### GetWorkerFullInfoRequest
Get a full informations related to specified Workers.
Get a full information related to specified Workers.
It includes Worker Config, HyperParameters and Metrics Logs.


Expand Down Expand Up @@ -669,7 +701,7 @@ Return a Worker list by specified condition.
<a name="api.GetWorkersRequest"/>

### GetWorkersRequest
Get a Worker Configs and Statuses from DB by ID of Study, Trial or Worker.
Get a configs and status of a Worker from DB by ID of Study, Trial or Worker.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -822,7 +854,7 @@ Return generated WorkerID.

### RegisterWorkerRequest
Create a Worker from Worker Config.
Generate a unique ID and store the Worker to DB.
Generate an unique ID and store the Worker to DB.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -1094,7 +1126,7 @@ Overview of a study. For UI.
<a name="api.SuggestionParameter"/>

### SuggestionParameter
Parameter for Suggestion service. Key value format.
Parameter for Suggestion service. Key-value format.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -1127,7 +1159,7 @@ Parameter for Suggestion service. Key value format.
<a name="api.Tag"/>

### Tag
Tag for each resources.
Tag for each resource.


| Field | Type | Label | Description |
Expand All @@ -1144,7 +1176,7 @@ Tag for each resources.

### Trial
A set of Hyperparameter.
In a study, multiple trials are evaluated by worker.
In a study, multiple trials are evaluated by workers.
Suggestion service will generate next trials.


Expand Down Expand Up @@ -1301,14 +1333,15 @@ https://cloud.google.com/service-infrastructure/docs/service-management/referenc
| GetStudyList | [GetStudyListRequest](#api.GetStudyListRequest) | [GetStudyListReply](#api.GetStudyListRequest) | Get all Study Configs from DB. |
| CreateTrial | [CreateTrialRequest](#api.CreateTrialRequest) | [CreateTrialReply](#api.CreateTrialRequest) | Create a Trial from Trial Config. Generate a unique ID and store the Trial to DB. |
| GetTrials | [GetTrialsRequest](#api.GetTrialsRequest) | [GetTrialsReply](#api.GetTrialsRequest) | Get a Trial Configs from DB by ID of Study. |
| GetTrial | [GetTrialRequest](#api.GetTrialRequest) | [GetTrialReply](#api.GetTrialRequest) | Get a Trial Configuration from DB by ID of Trial. |
| RegisterWorker | [RegisterWorkerRequest](#api.RegisterWorkerRequest) | [RegisterWorkerReply](#api.RegisterWorkerRequest) | Create a Worker from Worker Config. Generate a unique ID and store the Worker to DB. |
| GetWorkers | [GetWorkersRequest](#api.GetWorkersRequest) | [GetWorkersReply](#api.GetWorkersRequest) | Get a Worker Configs and Statuses from DB by ID of Study, Trial or Worker. |
| GetWorkers | [GetWorkersRequest](#api.GetWorkersRequest) | [GetWorkersReply](#api.GetWorkersRequest) | Get a Worker Configs and Status from DB by ID of Study, Trial or Worker. |
| UpdateWorkerState | [UpdateWorkerStateRequest](#api.UpdateWorkerStateRequest) | [UpdateWorkerStateReply](#api.UpdateWorkerStateRequest) | Update a Status of Worker. |
| GetWorkerFullInfo | [GetWorkerFullInfoRequest](#api.GetWorkerFullInfoRequest) | [GetWorkerFullInfoReply](#api.GetWorkerFullInfoRequest) | Get a full informations related to specified Workers. It includes Worker Config, HyperParameters and Metrics Logs. |
| GetWorkerFullInfo | [GetWorkerFullInfoRequest](#api.GetWorkerFullInfoRequest) | [GetWorkerFullInfoReply](#api.GetWorkerFullInfoRequest) | Get full information related to specified Workers. It includes Worker Config, HyperParameters and Metrics Logs. |
| GetSuggestions | [GetSuggestionsRequest](#api.GetSuggestionsRequest) | [GetSuggestionsReply](#api.GetSuggestionsRequest) | Get Suggestions from a Suggestion service. |
| GetShouldStopWorkers | [GetShouldStopWorkersRequest](#api.GetShouldStopWorkersRequest) | [GetShouldStopWorkersReply](#api.GetShouldStopWorkersRequest) | |
| GetMetrics | [GetMetricsRequest](#api.GetMetricsRequest) | [GetMetricsReply](#api.GetMetricsRequest) | Get metrics of workers. You can get all logs of metrics since start of the worker. |
| SetSuggestionParameters | [SetSuggestionParametersRequest](#api.SetSuggestionParametersRequest) | [SetSuggestionParametersReply](#api.SetSuggestionParametersRequest) | Create or Update parameter set for a suggestion service. When you specified a ID of parameter set, it will update the parameter set by your request. When you specified no ID, it will create a new parameter set for corresponding study and suggestion service. The parameters are key-value format. |
| SetSuggestionParameters | [SetSuggestionParametersRequest](#api.SetSuggestionParametersRequest) | [SetSuggestionParametersReply](#api.SetSuggestionParametersRequest) | Create or Update parameter set for a suggestion service. If you specify an ID of parameter set, it will update the parameter set by your request. If you don&#39;t specify an ID, it will create a new parameter set for corresponding study and suggestion service. The parameters are key-value format. |
| GetSuggestionParameters | [GetSuggestionParametersRequest](#api.GetSuggestionParametersRequest) | [GetSuggestionParametersReply](#api.GetSuggestionParametersRequest) | Get suggestion parameter set from DB specified. |
| GetSuggestionParameterList | [GetSuggestionParameterListRequest](#api.GetSuggestionParameterListRequest) | [GetSuggestionParameterListReply](#api.GetSuggestionParameterListRequest) | Get all suggestion parameter sets from DB. |
| SetEarlyStoppingParameters | [SetEarlyStoppingParametersRequest](#api.SetEarlyStoppingParametersRequest) | [SetEarlyStoppingParametersReply](#api.SetEarlyStoppingParametersRequest) | |
Expand Down
Loading

0 comments on commit fae6aa5

Please sign in to comment.