Skip to content

Commit

Permalink
Update samples yaml (#102)
Browse files Browse the repository at this point in the history
* Update samples yaml

* Remove configmap volumn part to keep the mini one clean
  • Loading branch information
ryantd authored Nov 21, 2021
1 parent 2c2bc7d commit 55ee446
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 36 deletions.
8 changes: 3 additions & 5 deletions ray-operator/config/samples/config-map-ray-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ kind: ConfigMap
metadata:
name: ray-code
data:
# note: /var should be writable to write to /var/ray_nodes.txt
code.py: |
sample_code.py: |
import ray
from ray import services
from os import environ
redis_pass = environ.get("REDIS_PASSWORD")
print("trying to connect to Ray!")
Expand All @@ -17,10 +15,10 @@ data:
@ray.remote
def f():
time.sleep(0.01)
return ray.services.get_node_ip_address()
return ray._private.services.get_node_ip_address()
values=set(ray.get([f.remote() for _ in range(1000)]))
print("Ray Nodes: ",str(values))
file = open("/var/ray_nodes.txt","a")
file = open("/tmp/ray_nodes.txt","a")
file.write("available nodes: %s\n" % str(values))
file.close()
end = time.time()
Expand Down
13 changes: 7 additions & 6 deletions ray-operator/config/samples/ray-cluster.complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
# An unique identifier for the head node and workers of this cluster.
name: raycluster-complete
spec:
rayVersion: '1.0.1'
rayVersion: '1.8.0'
######################headGroupSpecs#################################
# head group template and specs, (perhaps 'group' is not needed in the name)
headGroupSpec:
Expand Down Expand Up @@ -42,12 +42,12 @@ spec:
spec:
containers:
- name: ray-head
image: rayproject/autoscaler
image: rayproject/ray:1.8.0
# you can have any command and args here to run your code.
# the below command/args will be appended after the Ray start command and it args, and executed after Ray start.
command: ["python3"]
args:
- '/opt/code.py'
- '/opt/sample_code.py'
env:
- name: CPU_REQUEST
valueFrom:
Expand Down Expand Up @@ -97,8 +97,8 @@ spec:
name: ray-code
# An array of keys from the ConfigMap to create as files
items:
- key: code.py
path: code.py
- key: sample_code.py
path: sample_code.py
workerGroupSpecs:
# the pod replicas in this group typed worker
- replicas: 1
Expand Down Expand Up @@ -134,10 +134,11 @@ spec:
# the env var $RAY_IP is set by the operator if missing, with the value of the head service name
- name: init-myservice
image: busybox:1.28
# Change the cluster postfix if you don't have a default setting
command: ['sh', '-c', "until nslookup $RAY_IP.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done"]
containers:
- name: machine-learning # 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/autoscaler
image: rayproject/ray:1.8.0
# environment variables to set in the container.Optional.
# Refer to https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
env:
Expand Down
21 changes: 10 additions & 11 deletions ray-operator/config/samples/ray-cluster.getting-started.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
# An unique identifier for the head node and workers of this cluster.
name: raycluster-getting-started
spec:
rayVersion: '0.8.6' # should match the Ray version in the image of the containers
rayVersion: '1.8.0' # 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:
Expand Down Expand Up @@ -42,12 +42,12 @@ spec:
spec:
containers:
- name: ray-head
image: rayproject/autoscaler
image: rayproject/ray:1.8.0
# you can have any command and args here to run your code.
# the below command/args will be appended after the Ray start command and it args, and executed after Ray start.
command: ["python"]
args:
- '/opt/code.py'
- '/opt/sample_code.py'
env:
- name: MY_POD_IP
valueFrom:
Expand All @@ -66,8 +66,8 @@ spec:
name: ray-code-single
# An array of keys from the ConfigMap to create as files
items:
- key: code.py
path: code.py
- key: sample_code.py
path: sample_code.py
######################Ray code sample#################################
# this is only an example code that is mounted into the container and executed to show the Ray cluster at work
---
Expand All @@ -76,9 +76,8 @@ kind: ConfigMap
metadata:
name: ray-code-single
data:
code.py: |
sample_code.py: |
import ray
from ray import services
from os import environ
redis_pass = environ.get("REDIS_PASSWORD")
print("trying to connect to Ray!")
Expand All @@ -89,11 +88,11 @@ data:
@ray.remote
def f():
time.sleep(0.01)
return ray.services.get_node_ip_address()
return ray._private.services.get_node_ip_address()
values=set(ray.get([f.remote() for _ in range(1000)]))
print("Ray Nodes: ",str(values))
f = open("/var/ray_nodes.txt","a")
f.write("available nodes: %s\n" % str(values))
f.close()
file = open("/tmp/ray_nodes.txt","a")
file.write("available nodes: %s\n" % str(values))
file.close()
end = time.time()
print("Execution time = ",end - start)
17 changes: 9 additions & 8 deletions ray-operator/config/samples/ray-cluster.heterogeneous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
# An unique identifier for the head node and workers of this cluster.
name: raycluster-heterogeneous
spec:
rayVersion: '1.0.1'
rayVersion: '1.8.0'
######################headGroupSpecs#################################
# head group template and specs, (perhaps 'group' is not needed in the name)
headGroupSpec:
Expand Down Expand Up @@ -40,15 +40,14 @@ spec:
annotations:
key: value
spec:
# initContainers: # to avoid worker crashing before head service is created
containers:
- name: ray-head
image: rayproject/autoscaler
image: rayproject/ray:1.8.0
# you can have any command and args here to run your code.
# the below command/args will be appended after the Ray start command and it args, and executed after Ray start.
command: ["sleep"]
args:
- 'infinity'
- "infinity"
env:
- name: MY_POD_IP
valueFrom:
Expand All @@ -72,8 +71,8 @@ spec:
name: ray-code
# An array of keys from the ConfigMap to create as files
items:
- key: code.py
path: code.py
- key: sample_code.py
path: sample_code.py
workerGroupSpecs:
# the pod replicas in this group typed worker
- replicas: 3
Expand Down Expand Up @@ -107,10 +106,11 @@ spec:
# the env var $RAY_IP is set by the operator if missing, with the value of the head service name
- name: init-myservice
image: busybox:1.28
# Change the cluster postfix if you don't have a default setting
command: ['sh', '-c', "until nslookup $RAY_IP.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done"]
containers:
- name: machine-learning # 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/autoscaler
image: rayproject/ray:1.8.0
# environment variables to set in the container.Optional.
# Refer to https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
env:
Expand Down Expand Up @@ -178,10 +178,11 @@ spec:
initContainers:
- name: init-myservice
image: busybox:1.28
# Change the cluster postfix if you don't have a default setting
command: ['sh', '-c', "until nslookup raycluster-heterogeneous-head-svc.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done"]
containers:
- name: machine-learning # 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/autoscaler
image: rayproject/ray:1.8.0
# environment variables to set in the container.Optional.
# Refer to https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
env:
Expand Down
9 changes: 3 additions & 6 deletions ray-operator/config/samples/ray-cluster.mini.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
# An unique identifier for the head node and workers of this cluster.
name: raycluster-mini
spec:
rayVersion: '0.8.6' # should match the Ray version in the image of the containers
rayVersion: '1.8.0' # 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:
Expand Down Expand Up @@ -44,14 +44,14 @@ spec:
spec:
containers:
- name: ray-head
image: rayproject/ray:1.6.0
image: rayproject/ray:1.8.0
#image: rayproject/ray:nightly
#image: bonsaidev.azurecr.io/bonsai/lazer-0-9-0-cpu:dev
# you can have any command and args here to run your code.
# the below command/args will be appended after the Ray start command and it args, and executed after Ray start.
command: ["sleep"]
args:
- '10000'
- "infinity"
env:
- name: MY_POD_IP
valueFrom:
Expand All @@ -64,6 +64,3 @@ spec:
name: dashboard
- containerPort: 10001
name: client



0 comments on commit 55ee446

Please sign in to comment.