Skip to content

Commit 16e0574

Browse files
authored
Modify gRPC API with Current Request Number (#1728)
* Modify API to current_request_number * Changes after review * Add request_number deprecated API * Fix test
1 parent e72e5c8 commit 16e0574

File tree

27 files changed

+333
-245
lines changed

27 files changed

+333
-245
lines changed

docs/new-algorithm-service.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class HyperoptService(
5959
trials = Trial.convert(request.trials)
6060
#--------------------------------------------------------------
6161
# Your code here
62-
# Implement the logic to generate new assignments for the given request number.
63-
# For example, if request.request_number is 2, you should return:
62+
# Implement the logic to generate new assignments for the given current request number.
63+
# For example, if request.current_request_number is 2, you should return:
6464
# [
6565
# [Assignment(name=param-1, value=3),
6666
# Assignment(name=param-2, value=cat2),
@@ -73,7 +73,7 @@ class HyperoptService(
7373
# Assignment(name=param-4, value=4.32)
7474
# ],
7575
# ]
76-
list_of_assignments = your_logic(search_space, trials, request.request_number)
76+
list_of_assignments = your_logic(search_space, trials, request.current_request_number)
7777
#--------------------------------------------------------------
7878
# Convert list_of_assignments to
7979
return api_pb2.GetSuggestionsReply(

pkg/apis/manager/v1beta1/api.pb.go

Lines changed: 131 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/manager/v1beta1/api.proto

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,14 @@ message DeleteObservationLogReply {
288288

289289
message GetSuggestionsRequest {
290290
Experiment experiment = 1;
291-
repeated Trial trials = 2; // all completed trials owned by the experiment.
292-
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.
293-
int32 total_request_number = 4;//The number of Suggestions requested till now
291+
repeated Trial trials = 2; // All completed trials owned by the experiment.
292+
// Use current_request_number instead. This API will be removed in Katib 0.14.
293+
// The number of Suggestions requested at one time.
294+
int32 request_number = 3 [deprecated=true];
295+
// The number of Suggestions requested at one time.
296+
// When you set 3 to current_request_number, you get three Suggestions at one time.
297+
int32 current_request_number = 4;
298+
int32 total_request_number = 5; // The number of Suggestions requested till now.
294299
}
295300

296301
message GetSuggestionsReply {

pkg/apis/manager/v1beta1/gen-doc/api.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,10 @@ Discrete and Categorical type use List.
352352
| Field | Type | Label | Description |
353353
| ----- | ---- | ----- | ----------- |
354354
| experiment | [Experiment](#api.v1.beta1.Experiment) | | |
355-
| trials | [Trial](#api.v1.beta1.Trial) | repeated | all completed trials owned by the experiment. |
356-
| 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. |
357-
| total_request_number | [int32](#int32) | | The number of Suggestions requested till now |
355+
| trials | [Trial](#api.v1.beta1.Trial) | repeated | All completed trials owned by the experiment. |
356+
| 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. |
357+
| 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. |
358+
| total_request_number | [int32](#int32) | | The number of Suggestions requested till now. |
358359

359360

360361

pkg/apis/manager/v1beta1/gen-doc/index.html

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,27 +965,57 @@ <h3 id="api.v1.beta1.GetSuggestionsRequest">GetSuggestionsRequest</h3>
965965
<td>trials</td>
966966
<td><a href="#api.v1.beta1.Trial">Trial</a></td>
967967
<td>repeated</td>
968-
<td><p>all completed trials owned by the experiment. </p></td>
968+
<td><p>All completed trials owned by the experiment. </p></td>
969969
</tr>
970970

971971
<tr>
972972
<td>request_number</td>
973973
<td><a href="#int32">int32</a></td>
974974
<td></td>
975-
<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>
975+
<td><p><strong>Deprecated.</strong> Use current_request_number instead. This API will be removed in Katib 0.14.
976+
The number of Suggestions requested at one time. </p></td>
977+
</tr>
978+
979+
<tr>
980+
<td>current_request_number</td>
981+
<td><a href="#int32">int32</a></td>
982+
<td></td>
983+
<td><p>The number of Suggestions requested at one time.
984+
When you set 3 to current_request_number, you get three Suggestions at one time. </p></td>
976985
</tr>
977986

978987
<tr>
979988
<td>total_request_number</td>
980989
<td><a href="#int32">int32</a></td>
981990
<td></td>
982-
<td><p>The number of Suggestions requested till now </p></td>
991+
<td><p>The number of Suggestions requested till now. </p></td>
983992
</tr>
984993

985994
</tbody>
986995
</table>
987996

988997

998+
999+
1000+
<h4>Fields with deprecated option</h4>
1001+
<table>
1002+
<thead>
1003+
<tr>
1004+
<td>Name</td>
1005+
<td>Option</td>
1006+
</tr>
1007+
</thead>
1008+
<tbody>
1009+
1010+
<tr>
1011+
<td>request_number</td>
1012+
<td><p>true</p></td>
1013+
</tr>
1014+
1015+
</tbody>
1016+
</table>
1017+
1018+
9891019

9901020

9911021

0 commit comments

Comments
 (0)