Skip to content

Provide example config map for RayJob autoscaling #9110

@mimowo

Description

@mimowo

What would you like to be documented or improved:

I would like to provide an example configMap. Maybe as the one use for e2e tests:

apiVersion: v1
kind: ConfigMap
metadata:
  name: ray-job-autoscaling-code-sample
data:
  sample_code.py: |
    import ray
    import os

    ray.init()

    @ray.remote
    def my_task(x, s):
        import time
        time.sleep(s)
        return x * x

    # run tasks in sequence to avoid triggering autoscaling in the beginning
    print([ray.get(my_task.remote(i, 1)) for i in range(4)])

    # run tasks in parallel to trigger autoscaling (scaling up)
    print(ray.get([my_task.remote(i, 4) for i in range(16)]))

    # run tasks in sequence to trigger scaling down
    print([ray.get(my_task.remote(i, 1)) for i in range(32)])

https://kueue.sigs.k8s.io/docs/tasks/run/rayjobs/#example-rayjob-with-autoscaling
Location (URL, file path, or section if applicable):

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions