forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kuberay] Test Ray client and update autoscaler image (ray-project#24195
) This PR adds KubeRay e2e testing for Ray client and updates the suggested autoscaler image to one running the merge commit of PR ray-project#23883 .
- Loading branch information
1 parent
cc86440
commit d68c1ec
Showing
10 changed files
with
258 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
import ray | ||
|
||
|
||
@ray.remote(num_gpus=1, num_cpus=1) | ||
class GPUActor: | ||
def where_am_i(self): | ||
assert len(ray.get_gpu_ids()) == 1 | ||
return "on-a-gpu-node" | ||
def main(): | ||
"""Requests placement of a GPU actor.""" | ||
|
||
@ray.remote(num_gpus=1, num_cpus=1) | ||
class GPUActor: | ||
def where_am_i(self): | ||
assert len(ray.get_gpu_ids()) == 1 | ||
return "on-a-gpu-node" | ||
|
||
ray.init("auto", namespace="gpu-test") | ||
GPUActor.options(name="gpu_actor", lifetime="detached").remote() | ||
GPUActor.options(name="gpu_actor", lifetime="detached").remote() | ||
|
||
|
||
if __name__ == "__main__": | ||
ray.init("auto", namespace="gpu-test") | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import ray | ||
|
||
ray.init("auto", namespace="gpu-test") | ||
gpu_actor = ray.get_actor("gpu_actor") | ||
actor_response = ray.get(gpu_actor.where_am_i.remote()) | ||
print(actor_response) | ||
|
||
def main(): | ||
"""Confirms placement of a GPU actor.""" | ||
gpu_actor = ray.get_actor("gpu_actor") | ||
actor_response = ray.get(gpu_actor.where_am_i.remote()) | ||
return actor_response | ||
|
||
|
||
if __name__ == "__main__": | ||
ray.init("auto", namespace="gpu-test") | ||
out = main() | ||
print(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
import ray | ||
|
||
ray.init("auto", namespace="gpu-test") | ||
ray.autoscaler.sdk.request_resources(num_cpus=0) | ||
gpu_actor = ray.get_actor("gpu_actor") | ||
ray.kill(gpu_actor) | ||
|
||
def main(): | ||
"""Removes CPU request, removes GPU actor.""" | ||
ray.autoscaler.sdk.request_resources(num_cpus=0) | ||
gpu_actor = ray.get_actor("gpu_actor") | ||
ray.kill(gpu_actor) | ||
|
||
|
||
if __name__ == "__main__": | ||
ray.init("auto", namespace="gpu-test") | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import ray | ||
|
||
ray.init("auto") | ||
ray.autoscaler.sdk.request_resources(num_cpus=2) | ||
|
||
def main(): | ||
"""Submits CPU request.""" | ||
ray.autoscaler.sdk.request_resources(num_cpus=2) | ||
|
||
|
||
if __name__ == "__main__": | ||
ray.init("auto") | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import ray | ||
|
||
ray.init("auto") | ||
# Workers and head are annotated as having 5 "Custom2" capacity each, | ||
# so this should trigger upscaling of two workers. | ||
# (One of the bundles will be "placed" on the head.) | ||
ray.autoscaler.sdk.request_resources( | ||
bundles=[{"Custom2": 3}, {"Custom2": 3}, {"Custom2": 3}] | ||
) | ||
|
||
def main(): | ||
"""Submits custom resource request.""" | ||
# Workers and head are annotated as having 5 "Custom2" capacity each, | ||
# so this should trigger upscaling of two workers. | ||
# (One of the bundles will be "placed" on the head.) | ||
ray.autoscaler.sdk.request_resources( | ||
bundles=[{"Custom2": 3}, {"Custom2": 3}, {"Custom2": 3}] | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
ray.init("auto") | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.