Google AutoML错误-错误:4 DEADLINE_EXCEEDED:已超过最后期限

时间:2019-12-10 03:32:37

标签: node.js google-cloud-automl

我正在使用nodejs library通过以下代码将数据导入数据集中。

require("dotenv").config();
const automl = require("@google-cloud/automl");
const client = new automl.v1beta1.AutoMlClient();

(async () => {
  const projectId = `xxx`;
  const computeRegion = `us-central1`;
  const datasetId = `xxx`;
  const path = "gs://example_bucket_ocr_idr2/happiness.csv";

  // Get the full path of the dataset.
  const datasetFullId = client.datasetPath(projectId, computeRegion, datasetId);

  let inputConfig = {};
  if (path.startsWith(`bq`)) {
    // Get Bigquery URI.
    inputConfig = {
      bigquerySource: {
        inputUri: path
      }
    };
  } else {
    // Get the multiple Google Cloud Storage URIs.
    const inputUris = path.split(`,`);
    inputConfig = {
      gcsSource: {
        inputUris: inputUris
      }
    };
  }

  // Import the dataset from the input URI.
  client
    .importData({ name: datasetFullId, inputConfig: inputConfig })
    .then(responses => {
      const operation = responses[0];
      console.log(`Processing import...`);
      return operation.promise();
    })
    .then(responses => {
      // The final result of the operation.
      const operationDetails = responses[2];

      // Get the data import details.
      console.log("Data import details:");
      console.log(`\tOperation details:`);
      console.log(`\t\tName: ${operationDetails.name}`);
      console.log(`\t\tDone: ${operationDetails.done}`);
    })
    .catch(err => {
      console.error(err);
    });
})();

但是每次运行它时,都会出现 DEADLINE_EXCEEDED 错误。我一直在寻找解决方案,但直到现在都没有找到。

{ Error: 4 DEADLINE_EXCEEDED: Deadline exceeded
    at Object.callErrorFromStatus (/var/www/html/test/google-ml/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
    at Http2CallStream.call.on (/var/www/html/test/google-ml/node_modules/@grpc/grpc-js/build/src/client.js:96:33)
    at Http2CallStream.emit (events.js:198:15)
    at process.nextTick (/var/www/html/test/google-ml/node_modules/@grpc/grpc-js/build/src/call-stream.js:79:22)
    at processTicksAndRejections (internal/process/task_queues.js:79:9)
  code: 4,
  details: 'Deadline exceeded',
  metadata: Metadata { internalRepr: Map {}, options: {} } }

happiness.csv 文件包含以下内容:

gs://example_bucket_ocr_idr2/certs/01.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/02.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/03.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/04.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/05.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/06.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/07.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/08.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/09.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/10.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/11.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/12.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/13.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/14.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/15.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/16.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/17.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/18.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/19.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/20.pdf, certificates, post_graduation
gs://example_bucket_ocr_idr2/certs/21.pdf, certificates, post_graduation

任何帮助将不胜感激!

0 个答案:

没有答案