Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 committed Apr 27, 2023
1 parent ca929e9 commit 2a3a3bf
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions tests/config/ray-cluster.ray-ft.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,16 @@ data:
assert(val == "Hello world!")

test_ray_serve_2.py: |
import ray
import time
import sys
from ray import serve

def retry_with_timeout(func, timeout=90):
err = None
for i in range(timeout):
try:
print(f"retry iter: {i}")
return func()
except BaseException as e:
err = e
finally:
time.sleep(1)
raise err

print("Execute ray.init()")
retry_with_timeout(lambda: ray.init(address='ray://127.0.0.1:10001', namespace=sys.argv[1]))

print("Execute serve.start()")
retry_with_timeout(lambda:serve.start(detached=True))
import requests

print("Execute ray.get()")
val = retry_with_timeout(lambda: ray.get(serve.get_deployment("MyModelDeployment").get_handle().remote()))
print(val)
assert(val == "Hello world!")
try:
response = requests.get('http://127.0.0.1:8000', timeout=90)
print('Response status code:', response.status_code)
print('Response headers:', response.headers)
print('Response content:', response.text)
assert(response.text == 'Hello world!')
except requests.exceptions.RequestException as e:
raise SystemExit(e)

test_detached_actor_1.py: |
import ray
Expand Down

0 comments on commit 2a3a3bf

Please sign in to comment.