mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
Cleans up RayServe compatibility test. Co-authored-by: Ubuntu <azureuser@Ubuntu.pqxb1uggpgbehcpt4orv5untcb.rx.internal.cloudapp.net>
23 lines
591 B
Python
23 lines
591 B
Python
import ray
|
|
import time
|
|
import sys
|
|
from ray import serve
|
|
|
|
def retry_with_timeout(func, timeout=90):
|
|
err = None
|
|
for _ in range(timeout):
|
|
try:
|
|
return func()
|
|
except BaseException as e:
|
|
err = e
|
|
finally:
|
|
time.sleep(1)
|
|
raise err
|
|
|
|
retry_with_timeout(lambda: ray.init(address='ray://127.0.0.1:10001', namespace=sys.argv[1]))
|
|
retry_with_timeout(lambda:serve.start(detached=True))
|
|
val = retry_with_timeout(lambda: ray.get(serve.get_deployment("MyModelDeployment").get_handle().remote()))
|
|
print(val)
|
|
assert(val == "Hello world!")
|
|
|