'Exception while batch processing document with Google Cloud DocumentAI V1 - StatusCode="DeadlineExceeded"
I am trying to create PoC for Google Cloud DocumentAI V1 using this
I am using DocAI to convert .pdf files into text using DocAI BatchProcessing. I have created console application with below code, which is working fine with single document. But when I try to process multiple pdf documents it's throwing exception,
Grpc.Core.RpcException: 'Status(StatusCode="DeadlineExceeded", Detail="Deadline Exceeded", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1650465671.748000000","description":"Deadline Exceeded","file":"......\src\core\ext\filters\deadline\deadline_filter.cc","file_line":81,"grpc_status":4}")'
Application Code:
public static class DocAIBatchProcess
{
const string projectId = "PROJECTID";
const string processorId = "PROCESSID";
const string location = "us";
const string gcsInputBucketName = "BUCKETNAME";
const string gcsOutputBucketName = "gs://BUCKETNAME/OUTPUTFOLDER/";
const string gcsOutputUriPrefix = "PREFIX";
const string prefix = "INPUTFOLDER/";
const string delimiter = "/";
public static bool BatchProcessDocument(this IEnumerable<GCPStorage.Object> storageObjects)
{
Console.WriteLine("\n");
Console.WriteLine("Processing documents started...");
Console.WriteLine("-------------------------------");
DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
string name = $"projects/{projectId}/locations/{location}/processors/{processorId}";
GcsDocument gcsDocument = null;
GcsDocuments gcsDocuments = new GcsDocuments();
var storage = StorageClient.Create();
foreach (var storageObject in storageObjects)
{
if (storageObject.Name != prefix)
{
gcsDocument = new GcsDocument()
{
GcsUri = $"gs://gcsInputBucketName/{storageObject.Name}",
MimeType = "application/pdf"
};
gcsDocuments.Documents.Add(gcsDocument);
}
}
//Input Config
BatchDocumentsInputConfig inputConfig = new BatchDocumentsInputConfig();
inputConfig.GcsDocuments = gcsDocuments;
//Output Config
var fullGcsPath = $"gs://{gcsOutputBucketName}/{gcsOutputUriPrefix}/";
GcsOutputConfig gcsOutputConfig = new GcsOutputConfig();
gcsOutputConfig.GcsUri = gcsOutputBucketName;
DocumentOutputConfig documentOutputConfig = new DocumentOutputConfig();
documentOutputConfig.GcsOutputConfig = gcsOutputConfig;
// Configure the batch process request.
BatchProcessRequest batchProcessRequest = new BatchProcessRequest();
batchProcessRequest.Name = name;
batchProcessRequest.InputDocuments = inputConfig;
batchProcessRequest.DocumentOutputConfig = documentOutputConfig;
// Make the request
Operation<BatchProcessResponse, BatchProcessMetadata> response = documentProcessorServiceClient.BatchProcessDocuments(batchProcessRequest);
// Poll until the returned long-running operation is complete
Operation<BatchProcessResponse, BatchProcessMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchProcessResponse result = completedResponse.Result;
}
}
DeadlineExceeded : "Deadline expired before operation could complete."
I tried looking into documentation but couldn't find anything concreate. If someone knows about why this is happening ? Any assistance would be greatly appreciated.
Solution 1:[1]
This issue is related to network firewall for me. my network team just put me out of firewall and it worked without any issue. thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tt0206 |