Skip to content

Commit 7d3566b

Browse files
committed
fixingray init script
1 parent feec89a commit 7d3566b

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

‎modules/api/ray.py‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@
1414

1515
def ray_only():
1616
serve.shutdown()
17-
17+
18+
if "RAY_DOCKER" in os.environ:
19+
ray.init(
20+
dashboard_host=os.environ.get("RAY_DASHBOARD_HOST", "0.0.0.0"),
21+
dashboard_port=int(os.environ.get("RAY_DASHBOARD_PORT", 8265))
22+
)
23+
elif "RAY_HEAD_ADDRESS" in os.environ:
24+
ray.init(address=os.environ.get("RAY_HEAD_ADDRESS", ""))
25+
elif "RAY_SERVE_ONLY" in os.environ:
26+
pass
27+
else:
28+
ray.init()
29+
30+
1831
print("starting ray")
1932
serve.start(
2033

@@ -29,18 +42,3 @@ def ray_only():
2942
print("Done setting up replicas! Now accepting requests...")
3043
while True:
3144
time.sleep(1000)
32-
33-
34-
if __name__ == "__main__":
35-
36-
if "RAY_DOCKER" in os.environ:
37-
ray.init(
38-
dashboard_host=os.environ.get("RAY_DASHBOARD_HOST", "0.0.0.0"),
39-
dashboard_port=int(os.environ.get("RAY_DASHBOARD_PORT", 8265))
40-
)
41-
elif "RAY_HEAD_ADDRESS" in os.environ:
42-
ray.init(address=os.environ.get("RAY_HEAD_ADDRESS", ""))
43-
elif "RAY_SERVE_ONLY" in os.environ:
44-
ray_only()
45-
else:
46-
ray.init()

0 commit comments

Comments
 (0)