Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 committed Apr 28, 2023
1 parent 97cc682 commit 73b37b1
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions tests/config/ray-cluster.ray-ft.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ spec:
path: test_detached_actor_2.py
workerGroupSpecs:
# the pod replicas in this group typed worker
- replicas: 2
- replicas: 1
minReplicas: 1
maxReplicas: 2
# logical group name, for this called small-group, also can be functional
Expand Down Expand Up @@ -179,7 +179,7 @@ data:
def __call__(self):
return self._msg

ray.init()
ray.init(address='ray://127.0.0.1:10001')
# 2: Deploy the model.
handle = serve.run(MyModelDeployment.bind(msg="Hello world!"))
# 3: Query the deployment and print the result.
Expand All @@ -190,7 +190,6 @@ data:
test_ray_serve_2.py: |
import requests
import time
import json

def retry_with_timeout(func, timeout=90):
err = None
Expand All @@ -205,31 +204,19 @@ data:
raise err

def send_req():
response = requests.get('http://127.0.0.1:8000', timeout=60)
response = requests.get('http://127.0.0.1:8000', timeout=10)
print('Response status code:', response.status_code)
print('Response headers:', response.headers)
print('Response content:', response.text)
assert(response.text == "Hello world!")

def check_status():
headers = {
'Accept': 'application/json',
}
url = 'http://localhost:52365/api/serve/deployments/status'
response = requests.get(url, headers=headers)
status_json = json.loads(response.text)
print("Serve status:", status_json)
# Application "RUNNING": all deployments are healthy.
assert(status_json['app_status']['status'] == 'RUNNING')

retry_with_timeout(check_status, 240)
retry_with_timeout(send_req, 5)
retry_with_timeout(send_req, 180)

test_detached_actor_1.py: |
import ray
import sys

ray.init(namespace=sys.argv[1])
ray.init(address='ray://127.0.0.1:10001', namespace=sys.argv[1])

@ray.remote
class TestCounter:
Expand Down Expand Up @@ -270,7 +257,7 @@ data:

# Try to connect to Ray cluster.
print("Try to connect to Ray cluster.")
retry_with_timeout(lambda: ray.init(namespace=sys.argv[1]), timeout = 180)
retry_with_timeout(lambda: ray.init(address='ray://127.0.0.1:10001', namespace=sys.argv[1]), timeout = 180)

# Get TestCounter actor
print("Get TestCounter actor.")
Expand Down

0 comments on commit 73b37b1

Please sign in to comment.