数据融合无法解析JSON的响应

时间:2020-07-22 16:21:16

标签: google-cloud-platform google-cloud-data-fusion

我正在使用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}' }"  

其中argfile是参数设置程序宏的输入URL

参数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

        }

      ]

    }

  ]

}

这里的问题是我收到此错误

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]

当我尝试通过Data Fusion UI控制台传递参数设置器URL时,相同的管道在某些运行中可以使用相同的模板。

参数设置器JSON遵循https://github.com/data-integrations/argument-setter中规定的语法,并且参数json文件在存储分区中设置为public。

如果有人可以解决这个问题,将会很有帮助。

请注意,我在这里匿名了我的项目详细信息

1 个答案:

答案 0 :(得分:0)

假设您的存储桶是可公开访问的,那么您要提供给参数设置器的URL具有以下模式:

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

如果无法公开访问该存储桶,则需要为Google Cloud Storage中的参数文件生成一个签名的URL。您可以了解有关如何生成签名URL here的更多信息。