V1RayJob

polyaxon._flow.run.ray.ray.V1RayJob()

Ray jobs 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 rayjob
    • entrypoint: str, optional
    • runtime_env: Dict, optional
    • metadata: int, Dict, optional
    • ray_version: str, optional
    • head: V1RayReplica, optional
    • workers: Dict[str, V1RayReplica], optional

YAML usage

run:
  kind: rayjob
  entrypoint:
  runtimeEnv:
  metadata:
  rayVersion:
  head:
  workers:

Python usage

from polyaxon.schemas import V1Environment, V1Init, V1RayJob, V1RayReplica
ray_job = V1RayJob(
    connections=["connection-name1"],
    volumes=[k8s.V1Volume(...)],
    ray_version="2.5.0",
    head=V1RayReplica(...),
    worker=V1RayReplica(...),
)

Fields

kind

The kind signals to the CLI, client, and other tools that this component’s runtime is a job.

If you are using the python client to create the runtime, this field is not required and is set by default.

run:
  kind: rayjob

entrypoint

The entrypoint command for this job.

run:
  kind: rayjob
  entrypoint: python train.py

runtimeEnv

The runtime environment for this job.

run:
  kind: rayjob
  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: rayjob
  rayVersion: 2.5.0
  ...

Ray head replica specification

run:
  kind: rayjob
  head:
    rayStartParams:
      dashboard-host: '0.0.0.0'
    container:
    ...
  ...

workers

List of worker replica specifications

run:
  kind: rayjob
  workers:
    small-group:
      replicas: 1
      minReplicas: 1
      maxReplicas: 5
    ...
  ...