google-cloud-platform - 数据融合无法解析来自 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 是参数设置器宏的输入 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 文件在存储桶中设置为公共。
如果有人能解决这个问题会很有帮助。
请注意,我在这里匿名化了我的项目详细信息
解决方案
假设您的存储桶可公开访问,那么您要提供给参数设置器的 URL 具有以下模式:
https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]
如果存储桶不可公开访问,您将需要为 Google Cloud Storage 中的参数文件生成签名 URL。您可以在此处阅读有关如何生成签名 URL 的更多信息。
推荐阅读
- amazon-web-services - 如何在 SAM 模板中设置舞台名称
- sql - 在每个月的第二个和第四个星期四运行的重复 SQL 作业
- opencv - 如何使用 OpenCV 找到从相机到对象/标记的距离和旋转?
- parameters - 无法正确循环使用 Azure 数据工厂通配符的文件
- c++ - 使用 GN 构建预编译头文件
- javascript - 在useEffect中设置变量时如何触发函数?
- html - 我试图让我的网格响应使用网格模板和媒体查询
- apollo - Apollo GraphQL Fetch更多
- docker - 使用 docker-compose 在存储库中构建多个 dockerfile 之一
- amazon-web-services - 关于限制访问 AMI 以在亚马逊市场上销售