Azure / Azure/azure-sdk-for-python

Polling for document intelligence batch analysis result is broken

Aperta
#47,972 3 commenti 13 reazioni 1 assegnatario Rivendicata da @bojunehsu Vedi su GitHub
Client customer-reported Document Intelligence needs-team-attention question
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **package: azure-ai-documentintelligence**:
- **version: 1.0.2**:
- **os: macOS Tahoe 26.5.2**:
- **Python Version 3.11.11**:

**Describe the bug**
I am setting up a batch request to azure document intelligence using the async interface like the following and saving the continuation token.
```python
batch_request = AnalyzeBatchDocumentsRequest(
azure_blob_source=azure_blob_source,
result_container_url=container_url_with_sas,
result_prefix=result_prefix,
overwrite_existing=True,
)

poller = await self._document_intelligence_client.begin_analyze_batch_documents("prebuilt-layout", batch_request, locale="en")

continuation_token = poller.continuation_token()
```
Then in a queue I poll the job using the previously saved continuation token and print out all the statuses.
```python
poller = await self._document_intelligence_client.get_analyze_batch_result(continuation_token)
print(f"Poller done: {poller.done()}")
print(f"Poller status: {poller.status()}")

result: AnalyzeBatchResult = await poller.result()
print(f"Poller succeeded count: {result.succeeded_count}")
print(f"Poller failed count: {result.failed_count}")
print(f"Poller skipped count: {result.skipped_count}")
```
However even when the result is present, and therefore the analysis job is completed, the done() still returns False and status() still says InProgress.
```
Poller done: False
Poller status: InProgress
Poller succeeded count: 5
Poller failed count: 0
Poller skipped count: 0
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a begin_analyze_batch_documents request
2. Save the continuation token
3. Run poller.done() and poller.status(), poller.done() will be false and poller.status() will be InProgress even after the images have finished transcribing. poller.result() will return the successful files even when the other two method claim it isn't complete.

**Expected behavior**
I expect to be able to kick off a batch process and poll it for being done and once it is complete then get the result rather than having to call the blocking result() method and waiting.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.