Skip to content

Instantly share code, notes, and snippets.

@kevin85421
Created July 11, 2023 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevin85421/6a7779308aa45b197db8015aca0c1faf to your computer and use it in GitHub Desktop.
Save kevin85421/6a7779308aa45b197db8015aca0c1faf to your computer and use it in GitHub Desktop.
# Make sure to increase resource requests and limits before using this example in production.
# For examples with more realistic resource configuration, see
# ray-cluster.complete.large.yaml and
# ray-cluster.autoscaler.large.yaml.
apiVersion: ray.io/v1alpha1
kind: RayService
metadata:
name: rayservice-sample
spec:
serviceUnhealthySecondThreshold: 300 # Config for the health check threshold for service. Default value is 60.
deploymentUnhealthySecondThreshold: 300 # Config for the health check threshold for deployments. Default value is 60.
# The workload consists of two applications. The first application checks on an event in the second application.
# If the event isn't set, the first application will block on requests until the event is set. So, to test upscaling
# we can first send a bunch of requests to the first application, which will trigger Serve autoscaling to bring up
# more replicas since the existing replicas are blocked on requests. Worker pods should scale up. To test downscaling,
# set the event in the second application, releasing all blocked requests, and worker pods should scale down.
serveConfigV2: |
applications:
- name: fruit_app
import_path: fruit.deployment_graph
route_prefix: /fruit
runtime_env:
working_dir: "https://github.com/ray-project/test_dag/archive/41d09119cbdf8450599f993f51318e9e27c59098.zip"
deployments:
- name: MangoStand
num_replicas: 1
ray_actor_options:
num_cpus: 1
- name: OrangeStand
num_replicas: 1
ray_actor_options:
num_cpus: 1
- name: PearStand
num_replicas: 1
ray_actor_options:
num_cpus: 1
- name: FruitMarket
num_replicas: 1
ray_actor_options:
num_cpus: 1
- name: DAGDriver
num_replicas: 1
ray_actor_options:
num_cpus: 1
rayClusterConfig:
rayVersion: '2.5.0' # should match the Ray version in the image of the containers
## raycluster autoscaling config
enableInTreeAutoscaling: true
autoscalerOptions:
upscalingMode: Default
resources:
limits:
cpu: "1"
memory: "1000Mi"
requests:
cpu: "1"
memory: "1000Mi"
######################headGroupSpecs#################################
headGroupSpec:
# The `rayStartParams` are used to configure the `ray start` command.
# See https://github.com/ray-project/kuberay/blob/master/docs/guidance/rayStartParams.md for the default settings of `rayStartParams` in KubeRay.
# See https://docs.ray.io/en/latest/cluster/cli.html#ray-start for all available options in `rayStartParams`.
rayStartParams:
num-cpus: '0'
dashboard-host: '0.0.0.0'
#pod template
template:
spec:
containers:
- name: ray-head
image: rayproject/ray:2.5.0
resources:
limits:
cpu: 4
memory: 2Gi
requests:
cpu: 4
memory: 2Gi
ports:
- containerPort: 6379
name: gcs-server
- containerPort: 8265 # Ray dashboard
name: dashboard
- containerPort: 10001
name: client
- containerPort: 8000
name: serve
workerGroupSpecs:
# the pod replicas in this group typed worker
- replicas: 1
minReplicas: 1
maxReplicas: 5
# logical group name, for this called small-group, also can be functional
groupName: small-group
# The `rayStartParams` are used to configure the `ray start` command.
# See https://github.com/ray-project/kuberay/blob/master/docs/guidance/rayStartParams.md for the default settings of `rayStartParams` in KubeRay.
# See https://docs.ray.io/en/latest/cluster/cli.html#ray-start for all available options in `rayStartParams`.
rayStartParams: {}
#pod template
template:
spec:
containers:
- name: ray-worker # must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'
image: rayproject/ray:2.5.0
lifecycle:
preStop:
exec:
command: ["/bin/sh","-c","ray stop"]
resources:
limits:
cpu: "1"
memory: "2Gi"
requests:
cpu: "1"
memory: "2Gi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment