简体   繁体   English

Data Fusion 无法解析来自 JSON 的响应

[英]Data Fusion could not parse response from JSON

I am using the CDAP reference to start a Data fusion batch pipeline(GCS to GCS).我正在使用 CDAP 参考来启动数据融合批处理管道(GCS 到 GCS)。

curl -w "\n" -X POST -H "Authorization: Bearer ${AUTH_TOKEN}" \
"${CDAP_ENDPOINT}/v3/namespaces/default/apps/${PIPELINE_NAME}/workflows/DataPipelineWorkflow/start" \
-d "{ argfile : '${ARGUMENT_FILE}' }"  

where argfile is the input URL to the argument setter macro其中 argfile 是参数设置器宏的输入 URL

The argument json file is:参数 json 文件是:

{

  "arguments": [

    {

      "name": "input.path",

      "type": "string",

      "value": "gs://bucket/employee_sample.csv"

    },

    {

      "name": "directive",

      "type": "array",

      "value": [

        "parse-as-csv :body ',' true",

        "drop body"

      ]

    },

    {

      "name": "output.path",

      "type": "string",

      "value": "gs://bucket/FusionOutput"

    },

    {

      "name": "PROJECT_ID",

      "type": "string",

      "value": "project-id"

    },

    {

      "name": "output.schema",

      "type": "schema",

      "value": [

        {

          "name": "emp_id",

          "type": "string",

          "nullable": true

        },

        {

          "name": "name_prefix",

          "type": "string",

          "nullable": true

        },

        {

          "name": "first_name",

          "type": "string",

          "nullable": true

        }

      ]

    }

  ]

}

The problem here is that I am receiving this error这里的问题是我收到这个错误

Pipeline 'gcs_fusion' failed.
io.cdap.cdap.api.macro.InvalidMacroException: Argument 'input.path' is not defined.
    at io.cdap.cdap.etl.common.DefaultMacroEvaluator.lookup(DefaultMacroEvaluator.java:54) ~[na:na]
    at io.cdap.cdap.internal.app.runtime.plugin.MacroParser.findRightmostMacro(MacroParser.java:144)

java.lang.RuntimeException: Could not parse response from 'https://storage.cloud.google.com/bucket/argumentj.json': java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1
    at io.cdap.plugin.ArgumentSetter.handleResponse(ArgumentSetter.java:83) ~[na:na]
    at io.cdap.plugin.http.HTTPArgumentSetter.run(HTTPArgumentSetter.java:76) ~[na:na]

The same pipeline works with same template in some runs when I try to pass the argument setter URL through the Data Fusion UI Console.当我尝试通过 Data Fusion UI 控制台传递参数设置器 URL 时,相同的管道在某些运行中使用相同的模板。

The argument setter JSON follows the syntax prescribed in https://github.com/data-integrations/argument-setter and the argument json file is set to public in storage bucket.参数设置器 JSON 遵循https://github.com/data-integrations/argument-setter中规定的语法,参数 json 文件在存储桶中设置为公共。

Would be helpful if someone could resolve this.如果有人可以解决这个问题,将会很有帮助。

Note that I've anonymized my project details here请注意,我在这里匿名了我的项目详细信息

Assuming your bucket is publicly accessible, then the URL you want to provide to the argument setter have the following pattern:假设您的存储桶可公开访问,那么您要提供给参数设置器的 URL 具有以下模式:

https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]

If the bucket is not publicly accessible, you will need to generate a signed URL for the argument file in Google Cloud Storage.如果存储桶不可公开访问,您将需要为 Google Cloud Storage 中的参数文件生成签名的 URL。 You can read more about how to generate signed URL here .您可以在此处阅读有关如何生成签名 URL 的更多信息。

I've had the same problem, and I resolved it by making my bucket public, using the command below:我遇到了同样的问题,我通过使用以下命令公开我的存储桶来解决它:

gsutil iam ch allUsers:objectViewer gs://BUCKET_NAME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM