R
RunPod•8mo ago
Mateusz

Running serverless endpoint locally

Hi, I'm trying to run locally, but can't find a solution in documentation. I tried running handler with docker and outside docker. running with --rp_serve_api ERROR: [Errno 99] error while attempting to bind on address ('::1', 8000, 0, 0): cannot assign requested address running with --rp_serve_api --rp_api_host='0.0.0.0' exits with error: ERROR: [Errno -2] Name or service not known Is there some other sources I can look to solve this? Have a nice day! Mateusz
Solution:
python3 -u rp_handler.py --rp_serve_api --rp_api_port 8010 --rp_api_host 0.0.0.0
python3 -u rp_handler.py --rp_serve_api --rp_api_port 8010 --rp_api_host 0.0.0.0
...
Jump to solution
23 Replies
nerdylive
nerdylive•8mo ago
another app is using the address on ('::1', 8000)
digigoblin
digigoblin•8mo ago
Yeah you can either stop the other app or use a different port for running the handler
Solution
digigoblin
digigoblin•8mo ago
python3 -u rp_handler.py --rp_serve_api --rp_api_port 8010 --rp_api_host 0.0.0.0
python3 -u rp_handler.py --rp_serve_api --rp_api_port 8010 --rp_api_host 0.0.0.0
digigoblin
digigoblin•8mo ago
that will make it listen on port 8010 instead of 8000
Mateusz
MateuszOP•8mo ago
@digigoblin thanks! in docs and arts passing value is after =, I didn't try without it, my brain didn't notice that it may be wrong. It's running when passing value without = sign @digigoblin is there a way to define types for input and output to be generated in openapi file?
digigoblin
digigoblin•8mo ago
Not sure what you mean.
Mateusz
MateuszOP•8mo ago
openapi schema generation based on code. by default openapi file is generated when running serverless handler. It generates schemas and for request DefaultRequest by default. It defines input as object. When creating some custom endpoint we can make complex structures and it would be nice to put it into schema
nerdylive
nerdylive•8mo ago
GitHub
runpod-worker-a1111/schemas at main · ashleykleynhans/runpod-worker...
RunPod Serverless Worker for the Automatic1111 Stable Diffusion API - ashleykleynhans/runpod-worker-a1111
GitHub
runpod-worker-a1111/rp_handler.py at main · ashleykleynhans/runpod-...
RunPod Serverless Worker for the Automatic1111 Stable Diffusion API - ashleykleynhans/runpod-worker-a1111
nerdylive
nerdylive•8mo ago
it doesnt generate openapi file i guess but its for validation
digigoblin
digigoblin•8mo ago
RunPod allows OpenAPI compatible endpoints for the vllm worker, so you may want to look at using that.
digigoblin
digigoblin•8mo ago
GitHub
GitHub - runpod-workers/worker-vllm: The RunPod worker template for...
The RunPod worker template for serving our large language model endpoints. Powered by vLLM. - runpod-workers/worker-vllm
nerdylive
nerdylive•8mo ago
wdym openapi compatible endpoints?
digigoblin
digigoblin•8mo ago
You don't have to hack your worker to support them, its supported natively in RunPod serverless
digigoblin
digigoblin•8mo ago
GitHub
GitHub - runpod-workers/worker-vllm: The RunPod worker template for...
The RunPod worker template for serving our large language model endpoints. Powered by vLLM. - runpod-workers/worker-vllm
nerdylive
nerdylive•8mo ago
Oh you mean openai? I think that's not what he mean
digigoblin
digigoblin•8mo ago
He asked about it here. Sorry he said openapi not openai, my bad. You don't need openapi stuff with serverless.
Mateusz
MateuszOP•8mo ago
yeah, I was analysing all of those workers, that's why I'm asking questions here, because I can't find answers in other places 🙂 Thanks!
nerdylive
nerdylive•8mo ago
yeah i think validation hasnt been documented yet.. np
Mateusz
MateuszOP•8mo ago
why? They are still endpoints and in a team it would be nice to have openapi to share contracts automatically. you then can do some automated tests to make sure contracts are still valid. especially with proper CI/CD pipelines across the project and multiple repositories
digigoblin
digigoblin•8mo ago
You can't do this with serverless, only with an API on a pod. Serverless has fixed endpoints like /run and /runsync, it doesn't use custom endpoints, and also its already an API so you don't implement an API in your handler.
Mateusz
MateuszOP•8mo ago
I was just wandering if some overwriting would be possible to extend base definition, because in most cases input will have some structure defined. If don't then I understand. Thanks a lot for help!
digigoblin
digigoblin•8mo ago
You have to put the entire contents of your request within the input key of the payload, and then your response will be in the output key fo the payload. Its not possible to extend it.
Mateusz
MateuszOP•8mo ago
yes, and you can put something in this input and it can be an object, so it may be complex structure which you can define. so you could narrow input type generated currently with your type. so in the end it could be somehow "overwritten" or "extend" (you name it, it's just semantics) to have in openapi file (which is currently generated) more precise definition what intput and output are, not some generic list of every type.
Want results from more Discord servers?
Add your server