runpod-python
runpod-python copied to clipboard
Allow providing a custom API prefix for the serverless test server
Motivation
All the routes of the worker test server (e.g. /run, /sync, etc.) start at the root-level. This does not align with the public API schema where worker routes are of form /v2/{endpoint_id}/<route> and thus makes local testing difficult, particularly as the API prefix of the RP client cannot be modified directly.
Proposal
This PR introduces two additional command line arguments to the serverless worker test server: rp_api_prefix and rp_endpoint_id. The first allows setting an explicit prefix for the routes of the worker server, e.g. --rp_api_prefix=/v2/my_worker while the second is a shorthand to set the route prefix to resemble the official route corresponding to an endpoint ID.