Closed machakux closed 7 months ago
This issue should be fixed in the latest release v0.12.2-alpha
.
The default implementation should prevent the 429 Quota exceeded
error on its own, but if you still encounter issues, you can set a timeout as a parameter to Document.from_batch_process_operation(location, operation_name, timeout=100)
.
Environment details
Debian GNU/Linux 11 (bullseye)
3.11.2
23.3.2
google-cloud-documentai-toolbox
version:0.12.0a0
Steps to reproduce
Document.from_batch_process_operation()
in performing OCR on a PDF document with about 10+ pages via a fast/low-latency network (example from a Google Compute Engine VM).Code example
Stack trace
Based on my observation this is likely caused by the
_get_batch_process_metadata
function which has a long running loop requesting some metadata. https://github.com/googleapis/python-documentai-toolbox/blob/37e5d683ac421eed969ca3c8ad9970ea5e3629b8/google/cloud/documentai_toolbox/wrappers/document.py#L160-L166Possible solution could be introducing some mechanism to control the polling rate or a delay interval in the loop.