Skip to content

Commit 2ef248c

Browse files
committed
docs: update cluster configuration doc and add new ray cluster interaction doc
Signed-off-by: Bobbins228 <[email protected]>
1 parent ef13441 commit 2ef248c

File tree

2 files changed

+73
-3
lines changed

2 files changed

+73
-3
lines changed

docs/cluster-configuration.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ cluster = Cluster(ClusterConfiguration(
1818
worker_cpu_limits=1, # Default 1
1919
worker_memory_requests=2, # Default 2
2020
worker_memory_limits=2, # Default 2
21-
# image="", # Optional Field
22-
machine_types=["m5.xlarge", "g4dn.xlarge"],
21+
# image="", # Default quay.io/rhoai/ray:2.23.0-py39-cu121
2322
labels={"exampleLabel": "example", "secondLabel": "example"},
2423
))
2524
```
2625
Note: 'quay.io/rhoai/ray:2.23.0-py39-cu121' is the default community 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.
2726

2827
The `labels={"exampleLabel": "example"}` parameter can be used to apply additional labels to the RayCluster resource.
2928

30-
After creating their `cluster`, a user can call `cluster.up()` and `cluster.down()` to respectively create or remove the Ray Cluster.
29+
For detailed instructions on the various methods that can be called for interacting with Ray Clusters see [Ray Cluster Interaction](./ray_cluster_interaction.md).

docs/ray_cluster_interaction.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Ray Cluster Interaction
2+
3+
The CodeFlare SDK offers multiple ways to interact with Ray Clusters including the below methods.
4+
5+
## get_cluster()
6+
The `get_cluster()` function is used to initialise a `Cluster` object from a pre-existing Ray Cluster/AppWrapper. <br>
7+
Below is an example of it's usage:
8+
```
9+
from codeflare_sdk import get_cluster
10+
cluster = get_cluster(cluster_name="raytest", namespace="example", is_appwrapper=False, write_to_file=False)
11+
-> output: Yaml resources loaded for raytest
12+
13+
cluster.status()
14+
-> output:
15+
🚀 CodeFlare Cluster Status 🚀
16+
17+
╭─────────────────────────────────────────────────────────────────╮
18+
│ Name │
19+
│ raytest Active ✅ │
20+
│ │
21+
│ URI: ray://raytest-head-svc.example.svc:10001 │
22+
│ │
23+
│ Dashboard🔗 │
24+
│ │
25+
╰─────────────────────────────────────────────────────────────────╯
26+
(<CodeFlareClusterStatus.READY: 1>, True)
27+
28+
cluster.down()
29+
30+
cluster.up() # This function will create an exact copy of the retrieved Ray Cluster only if the Ray Cluster has been previously deleted.
31+
```
32+
33+
These are the parameters the `get_cluster()` function accepts:
34+
* `cluster_name: str # Required` -> The name of the Ray Cluster.
35+
* `namespace: str # Default: "default"` -> The namespace of the Ray Cluster.
36+
* `is_appwrapper: bool # Default: False` -> When set to `True` the function will attempt to retrieve an AppWrapper instead of a Ray Cluster.
37+
* `write_to_file: bool # Default: False` -> When set to `True` the Ray Cluster/AppWrapper will be written to a file similar to how it is done in `ClusterConfiguration`.
38+
39+
## list_all_queued()
40+
The `list_all_queued()` function returns (and prints by default) a list of all currently queued-up Ray Clusters in a given namespace.
41+
It accepts the following parameters:
42+
* `namespace: str # Required` -> The namespace you want to retrieve the list from.
43+
* `print_to_console: bool # Default: True` -> Allows the user to print the list to their console.
44+
* `appwrapper: bool # Default: False` -> When set to `True` allows the user to list queued AppWrappers.
45+
46+
47+
48+
## list_all_clusters()
49+
The `list_all_clusters()` function will return a list of detailed descriptions of Ray Clusters to the console by default. It accepts the following parameters:
50+
* `namespace: str # Required` -> The namespace you want to retrieve the list from.
51+
* `print_to_console: bool # Default: True` -> A boolean that allows the user to print the list to their console.
52+
53+
<br>
54+
NOTE: The following methods require a `Cluster` object to be initialised see [Cluster Configuration](./cluster-configuration.md)
55+
56+
## cluster.up()
57+
The `cluster.up()` function creates a Ray Cluster in the given namespace.
58+
59+
## cluster.down()
60+
The `cluster.down()` function deletes the Ray Cluster in the given namespace.
61+
62+
## cluster.status()
63+
The `cluster.status()` function prints out the status of the Ray Cluster's state with a link to the Ray Dashboard.
64+
65+
## cluster.details()
66+
The `cluster.details()` function prints out a detailed description of the Ray Cluster's status, worker resources and a link to the Ray Dashboard.
67+
68+
## cluster.wait_ready()
69+
The `cluster.wait_ready()` function waits for the requested cluster to be ready, up to an optional timeout and checks every 5 seconds. It accepts the following parameters:
70+
* `timeout: Optional[int] # Default: None` -> Allows the user to define a timeout for the `wait_ready()` function.
71+
* `dashboard_check: bool # Default: True` -> If enabled the `wait_ready()` function will wait until the Ray Dashboard is ready too.

0 commit comments

Comments
 (0)