使用 Google Cloud DocumentAI V1 批处理文档时出现异常 - StatusCode="DeadlineExceeded"

Exception while batch processing document with Google Cloud DocumentAI V1 - StatusCode="DeadlineExceeded"

我正在尝试使用 this

为 Google Cloud DocumentAI V1 创建 PoC

我正在使用 DocAI 通过 DocAI BatchProcessing 将 .pdf 文件转换为文本。我用下面的代码创建了控制台应用程序,它可以很好地处理单个文档。但是当我尝试处理多个 pdf 文档时它抛出异常,

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}")'

申请代码:

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:“截止日期已过,操作无法完成。”

我尝试查看文档,但找不到任何具体内容。如果有人知道为什么会这样?如有任何帮助,我们将不胜感激。

这个问题对我来说与网络防火墙有关。我的网络团队刚刚将我排除在防火墙之外,并且没有任何问题。谢谢