Skip to content

Commit

Permalink
Modify gRPC API with Current Request Number (#1728)
Browse files Browse the repository at this point in the history
* Modify API to current_request_number

* Changes after review

* Add request_number deprecated API

* Fix test
  • Loading branch information
andreyvelich committed Nov 5, 2021
1 parent e72e5c8 commit 16e0574
Show file tree
Hide file tree
Showing 27 changed files with 333 additions and 245 deletions.
6 changes: 3 additions & 3 deletions docs/new-algorithm-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class HyperoptService(
trials = Trial.convert(request.trials)
#--------------------------------------------------------------
# Your code here
# Implement the logic to generate new assignments for the given request number.
# For example, if request.request_number is 2, you should return:
# Implement the logic to generate new assignments for the given current request number.
# For example, if request.current_request_number is 2, you should return:
# [
# [Assignment(name=param-1, value=3),
# Assignment(name=param-2, value=cat2),
Expand All @@ -73,7 +73,7 @@ class HyperoptService(
# Assignment(name=param-4, value=4.32)
# ],
# ]
list_of_assignments = your_logic(search_space, trials, request.request_number)
list_of_assignments = your_logic(search_space, trials, request.current_request_number)
#--------------------------------------------------------------
# Convert list_of_assignments to
return api_pb2.GetSuggestionsReply(
Expand Down
248 changes: 131 additions & 117 deletions pkg/apis/manager/v1beta1/api.pb.go

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions pkg/apis/manager/v1beta1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,14 @@ message DeleteObservationLogReply {

message GetSuggestionsRequest {
Experiment experiment = 1;
repeated Trial trials = 2; // all completed trials owned by the experiment.
int32 request_number = 3; ///The number of Suggestion you request at one time. When you set 3 to request_number, you can get three Suggestions at one time.
int32 total_request_number = 4;//The number of Suggestions requested till now
repeated Trial trials = 2; // All completed trials owned by the experiment.
// Use current_request_number instead. This API will be removed in Katib 0.14.
// The number of Suggestions requested at one time.
int32 request_number = 3 [deprecated=true];
// The number of Suggestions requested at one time.
// When you set 3 to current_request_number, you get three Suggestions at one time.
int32 current_request_number = 4;
int32 total_request_number = 5; // The number of Suggestions requested till now.
}

message GetSuggestionsReply {
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/manager/v1beta1/gen-doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ Discrete and Categorical type use List.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| experiment | [Experiment](#api.v1.beta1.Experiment) | | |
| trials | [Trial](#api.v1.beta1.Trial) | repeated | all completed trials owned by the experiment. |
| request_number | [int32](#int32) | | The number of Suggestion you request at one time. When you set 3 to request_number, you can get three Suggestions at one time. |
| total_request_number | [int32](#int32) | | The number of Suggestions requested till now |
| trials | [Trial](#api.v1.beta1.Trial) | repeated | All completed trials owned by the experiment. |
| request_number | [int32](#int32) | | **Deprecated.** Use current_request_number instead. This API will be removed in Katib 0.14. The number of Suggestions requested at one time. |
| current_request_number | [int32](#int32) | | The number of Suggestions requested at one time. When you set 3 to current_request_number, you get three Suggestions at one time. |
| total_request_number | [int32](#int32) | | The number of Suggestions requested till now. |



Expand Down
36 changes: 33 additions & 3 deletions pkg/apis/manager/v1beta1/gen-doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -965,27 +965,57 @@ <h3 id="api.v1.beta1.GetSuggestionsRequest">GetSuggestionsRequest</h3>
<td>trials</td>
<td><a href="#api.v1.beta1.Trial">Trial</a></td>
<td>repeated</td>
<td><p>all completed trials owned by the experiment. </p></td>
<td><p>All completed trials owned by the experiment. </p></td>
</tr>

<tr>
<td>request_number</td>
<td><a href="#int32">int32</a></td>
<td></td>
<td><p>The number of Suggestion you request at one time. When you set 3 to request_number, you can get three Suggestions at one time. </p></td>
<td><p><strong>Deprecated.</strong> Use current_request_number instead. This API will be removed in Katib 0.14.
The number of Suggestions requested at one time. </p></td>
</tr>

<tr>
<td>current_request_number</td>
<td><a href="#int32">int32</a></td>
<td></td>
<td><p>The number of Suggestions requested at one time.
When you set 3 to current_request_number, you get three Suggestions at one time. </p></td>
</tr>

<tr>
<td>total_request_number</td>
<td><a href="#int32">int32</a></td>
<td></td>
<td><p>The number of Suggestions requested till now </p></td>
<td><p>The number of Suggestions requested till now. </p></td>
</tr>

</tbody>
</table>




<h4>Fields with deprecated option</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Option</td>
</tr>
</thead>
<tbody>

<tr>
<td>request_number</td>
<td><p>true</p></td>
</tr>

</tbody>
</table>





Expand Down
Loading

0 comments on commit 16e0574

Please sign in to comment.