[Core][Label Scheduling 1/n]Add NodeLabelSchedulingStrategy API in python#36418
[Core][Label Scheduling 1/n]Add NodeLabelSchedulingStrategy API in python#36418jjyao merged 1 commit intoray-project:masterfrom
Conversation
e96d370 to
8e53f5c
Compare
8e53f5c to
b2b6d13
Compare
b2b6d13 to
8c79eda
Compare
There was a problem hiding this comment.
Can we move this file into scheduling_strategies.py? All the other strategies are defined there.
8c79eda to
134e094
Compare
a3625e3 to
db02d91
Compare
There was a problem hiding this comment.
_convert_map_to_label_math_expressions
There was a problem hiding this comment.
I change to _convert_map_to_expressions. more concise.
There was a problem hiding this comment.
| "The value of label match expression in node label " | |
| "scheduling strategy must be created by " | |
| "`IN` or `NOT_IN` or`EXIST` or `DOES_NOT_EXIST`." | |
| "The value of label match expression in node label " | |
| "scheduling strategy must be " | |
| "`In` or `NotIn` or`Exists` or `DoesNotExist` operator." |
db02d91 to
0aa8344
Compare
There was a problem hiding this comment.
| class LabelMatchExpression: | |
| class _LabelMatchExpression: |
There was a problem hiding this comment.
| """The schedling strategy of node Affinity with labels | |
| Simplified usage: | |
| scheduling_strategy=NodeLabelSchedulingStrategy({ | |
| "region": IN("us"), | |
| "gpu_type": EXISTS() | |
| }) | |
| """ | |
| """Label based node affinity scheduling strategy | |
| scheduling_strategy=NodeLabelSchedulingStrategy({ | |
| "region": IN("us"), | |
| "gpu_type": EXISTS() | |
| }) | |
| """ |
0aa8344 to
93e0a61
Compare
There was a problem hiding this comment.
Be a little more specific here like Expected value {value} in position {index} to be of type str
|
Before this can be merged, the error messages should be improved:
Think about the user experience: They will get the error, and they will need to find out exactly which value caused the error. Currently that is extremely hard at best. |
93e0a61 to
9b850dd
Compare
I have fixed. Can you help me review again? |
There was a problem hiding this comment.
| if values is None or len(values) == 0: | |
| if not values: |
There was a problem hiding this comment.
The variadic parameter of the In operator must be a non-empty tuple: e.g. In("value1", "value2").
3edceb9 to
8bb6b7c
Compare
…thon Signed-off-by: LarryLian <554538252@qq.com>
8bb6b7c to
6071810
Compare
Discussed offline: currently the validation is done inside the operator constructor and we don't have the label key information. User should be able to rely on the stack trace to locate which operator is invalid without knowing the label key. |
…thon (ray-project#36418) Signed-off-by: LarryLian <554538252@qq.com>
…thon (ray-project#36418) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: NripeshN <nn2012@hw.ac.uk>
…thon (ray-project#36418) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
…thon (ray-project#36418) Signed-off-by: LarryLian <554538252@qq.com> Signed-off-by: Victor <vctr.y.m@example.com>
Why are these changes needed?
After our offline discussion, we have come up with the following plan. This API plan will review and finalization by more people in the future.
Complete form of API:
User also can use more simple api:
Related issue number
[Core][Labels Scheduling]Finalize the new node affinity scheduling with node labels API in the Python worker #36419
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.