Skip to content

Commit 58fee88

Browse files
committed
making some changes
1 parent 7d3566b commit 58fee88

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎modules/api/ray.py‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,39 @@
1111
#ray.init("ray://localhost:10001")
1212

1313

14+
ray_head_address = os.environ.get("RAY_ADDRESS")
15+
print("RAY_ADDRESS:", ray_head_address)
16+
17+
if ray_head_address:
18+
#ray.init(address=ray_head_address)
19+
ray.init(address=ray_head_address)
20+
#ray.init(address="172.21.0.3:6388")
21+
else:
22+
ray.init()
23+
24+
25+
entrypoint = Raypi.bind()
1426

1527
def ray_only():
1628
serve.shutdown()
17-
1829
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
30+
print("starting ray in docker")
31+
serve.start(
32+
detached=True,
33+
http_options={
34+
"host": os.environ.get("RAY_IP", "0.0.0.0"),
35+
"port": int(os.environ.get("RAY_PORT", 8000))
36+
}
37+
)
2738
else:
28-
ray.init()
29-
30-
31-
print("starting ray")
32-
serve.start(
33-
39+
serve.start(
3440
http_options={
3541
"host": os.environ.get("RAY_IP", "0.0.0.0"),
3642
"port": int(os.environ.get("RAY_PORT", 8000))
3743
}
3844
)
39-
4045
print(f"Starting Raypi on port {os.environ.get('RAY_PORT', 8000)}")
4146
serve.run(Raypi.bind(), port=int(os.environ.get("RAY_PORT", 8000)), route_prefix="/sdapi/v1") #route_prefix="/sdapi/v1" # Call the launch_ray method to get the FastAPI app
4247
print("Done setting up replicas! Now accepting requests...")
4348
while True:
44-
time.sleep(1000)
49+
time.sleep(1000)

‎modules/api/raypi.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ async def http_exception_handler(request: Request, e: HTTPException):
216216
"min_replicas": int(os.environ.get("RAY_MIN_REPLICAS", 0)),
217217
"max_replicas": int(os.environ.get("RAY_MAX_REPLICAS", 0))
218218
},
219+
route_prefix="/sdapi/v1"
219220
)
220221
@serve.ingress(app)
221222
class Raypi:

0 commit comments

Comments
 (0)