- Configure the server settings (port, host, concurrency)
- Control logging verbosity
- Enable debugging features
- Provide test inputs
Basic usage
To start your local server with additional flags, use the following format:your_function.py
with the name of your Python file containing the Runpod handler.
Available flags
—rp_serve_api
Starts the API server for local testing. Usage:—rp_api_port
Sets the port number for the FastAPI server. Default: 8000 Usage:--rp_api_host
to 0.0.0.0
allows connections from other devices on the network, which can be useful for testing but may have security implications.
—rp_api_concurrency
Sets the number of concurrent workers for the FastAPI server. Default: 1 Usage:When using
--rp_api_concurrency
with a value greater than 1, ensure your main file is named main.py
for proper FastAPI integration.—rp_api_host
Sets the hostname for the FastAPI server. Default: “localhost” Usage:—rp_log_level
Controls the verbosity of console output. Options:ERROR
| WARN
| INFO
| DEBUG
Usage:
—rp_debugger
Enables the Runpod debugger for troubleshooting. The--rp_debugger
flag is particularly useful when you need to step through your code for troubleshooting.
Usage:
—test_input
Provides test input data for your function, formatted as JSON. Usage:--test_input
flag is an alternative to using a test_input.json
file. If both are present, the command-line input takes precedence.
Combined flags
You can combine multiple flags to customize your local testing environment. For example:8080
with 4 concurrent workers, sets the log level to DEBUG
, and provides test input data.
These flags provide powerful tools for customizing your local testing environment. By using them effectively, you can simulate various scenarios, debug issues, and ensure your Serverless functions are robust and ready for deployment to the Runpod cloud.
For more detailed information on each flag and advanced usage scenarios, refer to the individual tutorials in this documentation.