1. Severity of the issue:
Medium: Significantly affects my productivity but can find a workaround.
2. Environment:
- Ray version: 2.45.0
- Python version: 3.9.22
- OS: ubuntu 20.04
- Cloud/Infrastructure: GCP
- Other libs/tools (if relevant):
3. What happened vs. what you expected:
- Expected: Query application status through Python/REST API should not trigger any modification to the current deployment
- Actual: Query application status through Python/REST API produce "Deploying new version of Deployment(name=‘xxx’, app=‘xxx’) " log
Github Issue: [Serve] Query application status API triggers re-deployment · Issue #53137 · ray-project/ray · GitHub
What happened + What you expected to happen
I am trying to deploy my application using Ray Serve and the application requires some local modules which are not in the working directory, so I pass them to runtime_env.py_modules
.
But when I try to query the application status using either Python API serve.status()
or REST API /api/serve/applications/
, I notice there are always one log for EACH application:
INFO 2025-05-19 20:01:02,637 controller 14198 -- Deploying new version of Deployment(name='xxx', app='xxx') (initial target replicas: 1).
If I remove the py_modules
field the log will not show when I run the query.
I check the return results from each query, and they are the same. So I suppose the controller does a try run of the deployment?
Reproduction script
from fastapi import FastAPI, Query, HTTPException
from ray import serve
import ray
app = FastAPI()
@serve.deployment(
name="hello_world",
)
@serve.ingress(app)
class HelloWorld:
@app.get("/hello")
async def hello(self):
return {"message": "Hello, world!"}
entrypoint = HelloWorld.bind()
ray.init(runtime_env={
"working_dir": "./",
"py_modules": ["https://storage.googleapis.com/kscale-text2img-app/deploy.zip"] # any other local dir/module have the same effect
})
serve.run(entrypoint, name="hello_world")
# for local test only
import time
while True:
time.sleep(3600)
And then run curl http://localhost:8265/api/serve/applications/
, you will always get a log:
INFO 2025-05-19 19:54:40,388 controller 12939 -- Deploying new version of Deployment(name='hello_world', app='hello_world') (initial target replicas: 1).