Skip to content

Polling for document intelligence batch analysis result is broken #47972

Description

@krishan-patel001
  • 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.

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.

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.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Document Intelligencecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions