runpod-python icon indicating copy to clipboard operation
runpod-python copied to clipboard

Async `/run` does not work when testing locally

Open abaybektursun opened this issue 1 year ago • 14 comments

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:

  1. Implement async handler
  2. Start the local server
runpod.serverless.start(
    {
        "handler": async_handler
    }
)
  1. Do a request: curl -X POST -H "Content-Type: application/json" -d '{"input":{}}' http://localhost:8000/run
  2. Observer how async_handler is 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

abaybektursun avatar Mar 19 '24 21:03 abaybektursun

@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.

discordianfish avatar Apr 18 '24 11:04 discordianfish

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"

discordianfish avatar Apr 18 '24 11:04 discordianfish

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 🤔

geovanisouza92 avatar Apr 22 '24 14:04 geovanisouza92

also have the same problem

xerdink avatar Apr 29 '24 18:04 xerdink

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.

discordianfish avatar Apr 30 '24 14:04 discordianfish

Same issue here. Very annoying

petem24 avatar Aug 13 '24 16:08 petem24

@justinmerrell any timeline on this? It makes local development extremely frustrating

petem24 avatar Aug 13 '24 17:08 petem24

Looks like calling the POST/status/{job-id} execute the job

Ostefanini avatar Sep 20 '24 13:09 Ostefanini

Same problem here. I receive {"detail":"Not Found"} when testing /run locally.

chemaguerra avatar Sep 26 '24 05:09 chemaguerra