|
| 1 | +# Ray Cluster Configuration |
| 2 | + |
| 3 | +To create Ray Clusters using the CodeFlare SDK a cluster configuration needs to be created first.<br> |
| 4 | +This is what a typical cluster configuration would look like; Note: The values for CPU and Memory are at the minimum requirements for creating the Ray Cluster. |
| 5 | + |
| 6 | +```python |
| 7 | +from codeflare_sdk import Cluster, ClusterConfiguration |
| 8 | + |
| 9 | +cluster = Cluster(ClusterConfiguration( |
| 10 | + name='ray-example', # Mandatory Field |
| 11 | + namespace='default', # Default None |
| 12 | + head_cpu_requests=1, # Default 2 |
| 13 | + head_cpu_limits=1, # Default 2 |
| 14 | + head_memory_requests=1, # Default 8 |
| 15 | + head_memory_limits=1, # Default 8 |
| 16 | + head_extended_resource_requests={'nvidia.com/gpu':0}, # Default 0 |
| 17 | + worker_extended_resource_requests={'nvidia.com/gpu':0}, # Default 0 |
| 18 | + num_workers=1, # Default 1 |
| 19 | + worker_cpu_requests=1, # Default 1 |
| 20 | + worker_cpu_limits=1, # Default 1 |
| 21 | + worker_memory_requests=2, # Default 2 |
| 22 | + worker_memory_limits=2, # Default 2 |
| 23 | + # image="", # Optional Field |
| 24 | + machine_types=["m5.xlarge", "g4dn.xlarge"], |
| 25 | + labels={"exampleLabel": "example", "secondLabel": "example"}, |
| 26 | +)) |
| 27 | +``` |
| 28 | +Note: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. If you have your own Ray image which suits your purposes, specify it in image field to override the default image. If you are using ROCm compatible GPUs you can use 'quay.io/modh/ray:2.35.0-py39-rocm61'. You can also find documentation on building a custom image [here](https://github.com/opendatahub-io/distributed-workloads/tree/main/images/runtime/examples). |
| 29 | + |
| 30 | +The `labels={"exampleLabel": "example"}` parameter can be used to apply additional labels to the RayCluster resource. |
| 31 | + |
| 32 | +After creating their `cluster`, a user can call `cluster.up()` and `cluster.down()` to respectively create or remove the Ray Cluster. |
| 33 | + |
| 34 | + |
| 35 | +## Deprecating Parameters |
| 36 | +The following parameters of the `ClusterConfiguration` are being deprecated in release `v0.22.0`. <!-- TODO: When removing deprecated parameters update this statement --> |
| 37 | +| Deprecated Parameter | Replaced By | |
| 38 | +| :--------- | :-------- | |
| 39 | +| `head_cpus` | `head_cpu_requests`, `head_cpu_limits` | |
| 40 | +| `head_memory` | `head_memory_requests`, `head_memory_limits` | |
| 41 | +| `min_cpus` | `worker_cpu_requests` | |
| 42 | +| `max_cpus` | `worker_cpu_limits` | |
| 43 | +| `min_memory` | `worker_memory_requests` | |
| 44 | +| `max_memory` | `worker_memory_limits` | |
| 45 | +| `head_gpus` | `head_extended_resource_requests` | |
| 46 | +| `num_gpus` | `worker_extended_resource_requests` | |
0 commit comments