Skip to content

Commit

Permalink
Update Ray documentation to reflect pod template updates
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Parraga <sovietaced@gmail.com>
  • Loading branch information
Sovietaced committed Feb 2, 2025
1 parent 02e0dc9 commit 86ba755
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions examples/ray_plugin/ray_plugin/ray_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# %% [markdown]
# # Running Ray Tasks
#
# The Ray task offers the capability to execute a Ray job either on a pre-existing Ray cluster
# or by creating a new Ray cluster using the Ray operator.
# The Ray task offers the capability to execute a Ray job on a dynamically created Ray cluster using the Ray operator.
#
# :::{Warning}
# **Version Compatibility**
Expand Down Expand Up @@ -51,7 +50,7 @@ def f(x):
# Here's a breakdown of the parameters:
#
# - `ray_start_params`: These are the [parameters](https://docs.ray.io/en/latest/ray-core/api/doc/ray.init.html)
# used in the Ray `init` method, encompassing the address and object-store-memory settings.
# used in the Ray `init` method, encompassing the object-store-memory settings.
# - `replicas`: Specifies the desired number of replicas for the worker group. The default is 1.
# - `group_name`: A RayCluster can host multiple worker groups, each differentiated by its name.
# - `runtime_env`: The [runtime environment](https://docs.ray.io/en/latest/ray-core/handling-dependencies.html#runtime-environments)
Expand Down Expand Up @@ -85,7 +84,8 @@ def ray_task(n: int) -> typing.List[int]:

# %% [markdown]
# :::{note}
# The `Resources` section here is utilized to specify the resources allocated to the worker nodes.
# By default, the `Resources` section here is utilized to specify the resources allocated to the head and nodes as well
# as the submitter pod.
# :::
#
# Lastly, define a workflow to call the Ray task.
Expand All @@ -102,6 +102,27 @@ def ray_workflow(n: int) -> typing.List[int]:
if __name__ == "__main__":
print(ray_workflow(n=10))

# %% [markdown]
# ## Ray Head & Worker Node Customization
#
# By default, the Ray plugin will base much of the configuration for the Ray head and worker node pods in the Ray
# cluster based on the Ray job submitter pod derived from the task decorator. In some cases it is useful to customize
# the Ray head and worker node pods and the Ray plugin supports this with optional `k8s_pod` arguments for both the
# {py:class}`~flytekitplugins.ray.HeadNodeConfig` and {py:class}`~flytekitplugins.ray.WorkerNodeConfig` classes.
#
# This argument allows users to pass in a completely customized pod template. The Ray plugin will use the following
# configurations if there are defined in the pod template:
#
# - Container resource requests (can also be set with the `requests` helper method)
# - Container resource limits (can also be set with the `limits` helper method)
# - Pod runtime class name
#
# :::{note}
# Containers in the pod template must match the target container name for the Ray cluster node (ie. ray-head or
# ray worker). Otherwise, the customized configuration will not take effect.
# :::
# %%

# %% [markdown]
# ## Troubleshoot
#
Expand Down

0 comments on commit 86ba755

Please sign in to comment.