Data Fusion 无法解析来自 JSON 的响应
Data Fusion could not parse response from JSON
我正在使用 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 是参数 setter 宏的输入 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 控制台传递参数 setter URL 时,相同的管道在某些运行中使用相同的模板。
参数setter JSON遵循https://github.com/data-integrations/argument-setter中规定的语法,参数json文件设置为存储桶中的public。
如果有人能解决这个问题将会很有帮助。
请注意,我在这里匿名了我的项目详细信息
假设您的存储桶可公开访问,那么您要提供给参数 setter 的 URL 具有以下模式:
https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]
如果存储桶不可公开访问,您将需要在 Google 云存储中为参数文件生成签名 URL。您可以阅读更多有关如何生成签名的 URL here.
我正在使用 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 是参数 setter 宏的输入 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 控制台传递参数 setter URL 时,相同的管道在某些运行中使用相同的模板。
参数setter JSON遵循https://github.com/data-integrations/argument-setter中规定的语法,参数json文件设置为存储桶中的public。
如果有人能解决这个问题将会很有帮助。
请注意,我在这里匿名了我的项目详细信息
假设您的存储桶可公开访问,那么您要提供给参数 setter 的 URL 具有以下模式:
https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]
如果存储桶不可公开访问,您将需要在 Google 云存储中为参数文件生成签名 URL。您可以阅读更多有关如何生成签名的 URL here.