-
Notifications
You must be signed in to change notification settings - Fork 446
/
Copy pathray-cluster.mini.yaml.template
70 lines (67 loc) · 1.89 KB
/
ray-cluster.mini.yaml.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
apiVersion: ray.io/v1
kind: RayCluster
metadata:
name: raycluster-mini
spec:
rayVersion: '$ray_version' # should match the Ray version in the image of the containers
######################headGroupSpecs#################################
# head group template and specs, (perhaps 'group' is not needed in the name)
headGroupSpec:
# the following params are used to complete the ray start: ray start --head --block ...
rayStartParams:
num-cpus: '1'
#pod template
template:
spec:
containers:
- name: ray-head
image: $ray_image
ports:
- containerPort: 6379
name: redis
- containerPort: 8265 # Ray dashboard
name: dashboard
- containerPort: 10001
name: client
volumeMounts:
- mountPath: /home/ray/samples
name: test-script-configmap
volumes:
- name: test-script-configmap
configMap:
name: test-script
# An array of keys from the ConfigMap to create as files
items:
- key: simple_code.py
path: simple_code.py
workerGroupSpecs:
- replicas: 1
minReplicas: 1
maxReplicas: 1
groupName: small-group
# the following params are used to complete the ray start: ray start --num-cpus=1 --block
rayStartParams:
num-cpus: '1'
#pod template
template:
spec:
containers:
- name: ray-worker
image: $ray_image
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test-script
data:
simple_code.py: |
import ray
ray.init()
# Define the square task.
@ray.remote
def square(x):
return x * x
# Launch four parallel square tasks.
futures = [square.remote(i) for i in range(4)]
# Check results.
assert ray.get(futures) == [0, 1, 4, 9]