diff --git a/doc/source/serve/advanced-guides/dev-workflow.md b/doc/source/serve/advanced-guides/dev-workflow.md index de8b6745a400..19db067f9cbf 100644 --- a/doc/source/serve/advanced-guides/dev-workflow.md +++ b/doc/source/serve/advanced-guides/dev-workflow.md @@ -79,6 +79,20 @@ After you're done testing, you can shut down Ray Serve by interrupting the `serv Note that rerunning `serve run` will redeploy all deployments. To prevent redeploying those deployments whose code hasn't changed, you can use `serve deploy`; see the [Production Guide](serve-in-production) for details. +### Local Testing Mode + +Ray Serve now supports a local testing mode that allows you to test your application logic in-process without deploying to a Ray cluster. This can be useful for unit testing and debugging. + +To enable local testing mode, you can set the `_local_testing_mode` flag to `True` when calling `serve.run`: + +```python +serve.run(app, _local_testing_mode=True) +``` + +Alternatively, you can set the environment variable `RAY_SERVE_FORCE_LOCAL_TESTING_MODE=1` to force local testing mode for all `serve.run` invocations. + +In local testing mode, deployments run in the local process, which enables faster development iterations and the use of debugging tools like PDB. However, some features like converting deployment responses to Ray object references are not supported in this mode. + ## Testing on a remote cluster To test on a remote cluster, you'll use `serve run` again, but this time you'll pass in an `--address` argument to specify the address of the Ray cluster to connect to. For remote clusters, this address has the form `ray://:10001`; see [Ray Client](ray-client-ref) for more information.