V1RayReplica
polyaxon._flow.run.ray.replica.V1RayReplica()
Ray replica is the specification for a Ray head or worker.
- Args:
- replicas: str, optional int
- min_replicas: str, int, optional
- max_replicas: str, int, optional
- ray_start_params: str, Dict[str, str], optional
- environment: V1Environment, optional
- connections: List[str], optional
- volumes: List[Kubernetes Volume], optional
- init: List[V1Init], optional
- sidecars: List[sidecar containers], optional
- container: Kubernetes Container
YAML usage
head / workerName:
replicas:
minReplicas:
maxReplicas:
rayStartParams:
environment:
connections:
volumes:
init:
sidecars:
container:
Python usage
from polyaxon.schemas import V1Environment, V1Init, V1RayReplica
from polyaxon import k8s
replica = V1RayReplica(
replicas=2,
environment=V1Environment(...),
init=[V1Init(...)],
sidecars=[k8s.V1Container(...)],
container=k8s.V1Container(...),
)
Fields
replicas
The number of worker replica instances.
executor:
replicas: 2
minReplicas
The minimum number of worker replica instances.
executor:
minReplicas: 1
maxReplicas
The maximum number of worker replica instances.
executor:
minReplicas: 1
rayStartParams
The ray start parameters.
head:
rayStartParams:
"dashboard-host": "0.0.0.0"
"block": "true"
"num-cpus": "0"
environment
Optional environment section, it provides a way to inject pod related information into the replica (executor/driver).
worker:
environment:
labels:
key1: "label1"
key2: "label2"
annotations:
key1: "value1"
key2: "value2"
nodeSelector:
node_label: node_value
...
...
connections
A list of connection names to resolve for the job.
If you are referencing a connection it must be configured. All referenced connections will be checked:
If they are accessible in the context of the project of this run
If the user running the operation can have access to those connections
After checks, the connections will be resolved and inject any volumes, secrets, configMaps, environment variables for your main container to function correctly.
replica:
connections: [connection1, connection2]
init
A list of init handlers and containers to resolve for the replica (executor/driver).
If you are referencing a connection it must be configured. All referenced connections will be checked:
If they are accessible in the context of the project of this run
If the user running the operation can have access to those connections
replica:
init:
- artifacts:
dirs: ["path/on/the/default/artifacts/store"]
- connection: gcs-large-datasets
artifacts:
dirs: ["data"]
container:
resources:
requests:
memory: "256Mi"
cpu: "500m"
- container:
name: myapp-container
image: busybox:1.28
command: ['sh', '-c', 'echo custom init container']
sidecars
A list of sidecar containers that will be used as sidecars.
replica:
sidecars:
- name: sidecar2
image: busybox:1.28
command: ['sh', '-c', 'echo sidecar2']
- name: sidecar1
image: busybox:1.28
command: ['sh', '-c', 'echo sidecar1']
resources:
requests:
memory: "128Mi"
cpu: "500m"
container
The main Kubernetes Container that will run your experiment training or data processing logic for the replica (executor/driver).
replica:
init:
- connection: my-code-repo
container:
name: tensorflow:2.1
command: ["python", "/plx-context/artifacts/my-code-repo/model.py"]