I'm following the docs and created a verey simple handler.py with the following:
import runpod
def handler(event):
"""
This is a sample handler function that echoes the input
and adds a greeting.
"""
try:
# Extract the prompt from the input
prompt = event["input"]["prompt"]
print (f"Prompt: {prompt}")
result = f"Hello! You said: {prompt}"
# Return the result
return {"output": result}
except Exception as e:
# If there's an error, return it
return {"error": str(e)}
# Start the serverless function
runpod.serverless.start({"handler": handler})
This is running inside a Docker container with a custom Dockerfile and executed with
python3 ./handler.py --rp_serve_api --rp_api_host 0.0.0.0 --rp_api_port 8000
The local server starts:
--- Starting Serverless Worker | Version 1.6.2 ---
INFO | Starting API server.
DEBUG | Not deployed on RunPod serverless, pings will not be sent.
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
But when I POST localhost:8000/run with the expected prompt input, I get a id back saying the job is in progress, but nothing shows on the container logs. It doesn't run until I call /status/jobId. Only then it runs.
Is this the expected behaviour? If so, why?