无法通过Azure DataBricks /clusters API编辑custom-tags的问题及解决
我尝试使用Databricks集群编辑API更新集群的custom_tags,但遇到的错误提示和官方文档标注的必填参数不符——文档显示仅cluster_id和spark_version为必填项,实际请求却报错。
请求示例
curl --location --request POST 'https://databricks.com/api/2.0/clusters/edit' \ --header 'Authorization: Bearer token' \ --header 'Content-Type: application/json' \ --data-raw '{ "cluster_id": 1234567, "cluster_version": "10.4.x-scala2.12", "custom_tags": { "TEST": "TEST" } }'
错误响应(状态码400)
{ "error_code": "INVALID_PARAMETER_VALUE", "message": "Exactly 1 of virtual_cluster_size, num_workers or autoscale must be specified.", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "CM_API_ERROR_SOURCE_CALLER_ERROR", "domain": "" } ] }
解决方法
感谢@JayashankarGS的帮助,已解决问题,总结关键点:
- 尽管文档未明确说明,但必须指定
virtual_cluster_size、num_workers或autoscale(含min_workers和max_workers)三者之一 node_type_id为必填项,文档未提及该要求/edit接口对custom_tags的操作是覆盖原有值,务必解析并添加现有标签到请求中,否则原有标签会丢失
内容的提问来源于stack exchange,提问作者ericOnline
相关产品推荐
相关产品推荐

