V1RayCluster
polyaxon._flow.run.ray.ray.V1RayCluster()Ray clusters are used to run Ray applications on Kubernetes.
Ray Ray is an open-source unified compute framework that makes it easy to scale AI and Python workloads, from reinforcement learning to deep learning to tuning, and model serving.
- Args:
- kind: str, should be equal
raycluster - entrypoint: str, optional
- runtime_env: Dict, optional
- metadata: int, Dict, optional
- ray_version: str, optional
- head: V1RayReplica, optional
- workers: Dict[str, V1RayReplica], optional
- enable_in_tree_autoscaling: bool, optional
- autoscaler_options: V1RayAutoscalerOptions, optional
- kind: str, should be equal
YAML usage
run:
kind: raycluster
entrypoint:
runtimeEnv:
metadata:
rayVersion:
head:
workers:
enableInTreeAutoscaling:
autoscalerOptions:Python usage
from polyaxon.schemas import V1Environment, V1Init, V1RayCluster, V1RayReplica
ray_cluster = V1RayCluster(
connections=["connection-name1"],
volumes=[k8s.V1Volume(...)],
ray_version="2.5.0",
head=V1RayReplica(...),
worker=V1RayReplica(...),
enable_in_tree_autoscaling=True,
)Fields
kind
The kind signals to the CLI, client, and other tools that this component’s runtime is a cluster.
If you are using the python client to create the runtime, this field is not required and is set by default.
run:
kind: rayclusterentrypoint
The entrypoint command for this cluster.
run:
kind: raycluster
entrypoint: python train.pyruntimeEnv
The runtime environment for this cluster.
run:
kind: raycluster
runtimeEnv:
pip: ["requests==2.26.0", "pendulum==2.1.2"]
env_vars: {"counter_name": "test_counter"}rayVersion
The version of Ray the application uses.
run:
kind: raycluster
rayVersion: 2.5.0
...head
Ray head replica specification
run:
kind: raycluster
head:
rayStartParams:
dashboard-host: '0.0.0.0'
container:
...
...workers
List of worker replica specifications
run:
kind: raycluster
workers:
small-group:
replicas: 1
minReplicas: 1
maxReplicas: 5
...
...enableInTreeAutoscaling
Enable the KubeRay in-tree autoscaler for automatic worker scaling. When enabled, the Ray autoscaler will automatically scale workers based on workload demands.
Note: The
idleTimeoutSecondsfor the autoscaler is derived fromtermination.culling.timeout.
run:
kind: raycluster
enableInTreeAutoscaling: true
workers:
gpu-workers:
minReplicas: 0
maxReplicas: 10
...autoscalerOptions
Optional configuration for the Ray autoscaler behavior.
run:
kind: raycluster
enableInTreeAutoscaling: true
autoscalerOptions:
upscalingMode: Default
imagePullPolicy: IfNotPresent
...