Docling-Serve request timeout #2226
Replies: 3 comments
-
To handle long-running extractions with docling-serve, you should use the asynchronous endpoints ( The async workflow is: submit your job via the async endpoint, get a Example with httpx (polling): import httpx
import time
# Submit the async job
with httpx.Client() as client:
response = client.post("http://localhost:5001/v1/convert/file/async", files=files, data=parameters)
task = response.json()
# Poll for status
while task["task_status"] not in ("success", "failure"):
response = httpx.get(f"http://localhost:5001/v1/status/poll/{task['task_id']}")
task = response.json()
time.sleep(5)
# Fetch result when done
if task["task_status"] == "success":
result = httpx.get(f"http://localhost:5001/v1/result/{task['task_id']}")
# handle result You can set the httpx timeout as high as you want, but for async jobs, each poll is a short request, so the default is usually fine. The server-side Summary: use async endpoints and poll or subscribe for status; don't rely on httpx timeouts for long-running synchronous requests. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Thank you for quick reply. I will try this solution. |
Beta Was this translation helpful? Give feedback.
-
I am getting "timed out" error using this code I am using below command to run container |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I’m using Docling to extract from .pdf and .docx.
Now I want to switch the extraction part to use docling-serve.
That means I need to call docling-serve from my client code, and I’m planning to use the httpx library for that.
My confusion:
So, my question is: How do I use httpx so it will reliably wait for the docling-serve response, even for long extractions?
Beta Was this translation helpful? Give feedback.
All reactions