runpod-python
runpod-python copied to clipboard
Async `/run` does not work when testing locally
Describe the bug
When I create a handler runpod.serverless.start({"handler": async_generator_handler})
Only http://localhost:8000/runsync triggers async_generator_handler
However when posting against http://localhost:8000/run async_generator_handler is not triggered. Just returns
{"id":"test-20023617-4048-4f73-9511-8ae17a1ad7a5","status":"IN_PROGRESS"}
But nothing happens in the backend
To Reproduce Steps to reproduce the behavior:
- Implement async handler
- Start the local server
runpod.serverless.start(
{
"handler": async_handler
}
)
- Do a request:
curl -X POST -H "Content-Type: application/json" -d '{"input":{}}' http://localhost:8000/run - Observer how
async_handleris not triggered
Expected behavior
async_handler should be triggered.
Desktop (please complete the following information):
- OS: Ubuntu 23
- Version: Runpod python SDK: 1.6.2
Also posted in Discord support: https://www.answeroverflow.com/m/1219122522612830279
@justinmerrell Is there a timeline to fix this? It would make local development and testing so much easier if I could use async / status locally. Just storing the job status in memory would be sufficient.
Hrm maybe I'm missing something because from looking at the code, it seems that it should actually:
- add jobs: https://github.com/runpod/runpod-python/blob/f6971a8f142a7b4796fb0f1ffa3b3f201d130a81/runpod/serverless/modules/rp_fastapi.py#L292
- and return them on status: https://github.com/runpod/runpod-python/blob/f6971a8f142a7b4796fb0f1ffa3b3f201d130a81/runpod/serverless/modules/rp_fastapi.py#L331
But it seems that when I try to get the job status it always returns:
"status": "FAILED", "error": "Job ID not found"
But it seems that when I try to get the job status it always returns:
"status": "FAILED", "error": "Job ID not found"
Same here. My guess it's removing the jobs from memory 🤔
also have the same problem
Looks like it removes the job here: https://github.com/runpod/runpod-python/blob/f6971a8f142a7b4796fb0f1ffa3b3f201d130a81/runpod/serverless/modules/rp_fastapi.py#L388
I don't get why.. looks like on the first request its still there and then gets removed by this.
Same issue here. Very annoying
@justinmerrell any timeline on this? It makes local development extremely frustrating
Looks like calling the POST/status/{job-id} execute the job
Same problem here. I receive {"detail":"Not Found"} when testing /run locally.