Dataproc集群任务失败:gcloud报AttributeError错误求助
Dataproc集群任务执行失败:gcloud AttributeError排查与解决
错误现象
执行Dataproc集群任务时触发gcloud崩溃,错误日志如下:
ERROR: gcloud crashed (AttributeError): 'bool' object has no attribute 'lower' If you would like to report this issue, please run the following command: gcloud feedback To check gcloud for common problems, please run the following command: gcloud info --run-diagnostics
运行gcloud info --run-diagnostics后未检测到异常:
$ gcloud info --run-diagnostics Network diagnostic detects and fixes local network connection issues. Checking network connection...done. Reachability Check passed. Network diagnostic passed (1/1 checks passed). Property diagnostic detects issues that may be caused by properties. Checking hidden properties...done. Hidden Property Check passed. Property diagnostic passed (1/1 checks passed).
可能原因
- gcloud配置中存在布尔类型属性值,而CLI代码错误地对其调用仅适用于字符串的
lower()方法。 - 自定义或脚本设置的gcloud属性被误设为布尔值(如
true/false而非字符串格式的"true"/"false")。 - 所用gcloud SDK版本存在bug,对布尔属性的处理逻辑有缺陷。
解决步骤
- 检查并修正gcloud配置属性
- 列出所有配置属性:
gcloud config list --all - 查找值为无引号布尔类型(
true/false)的项,重点排查Dataproc相关配置(如dataproc.*前缀)。 - 将布尔值改为字符串格式,示例:
gcloud config set dataproc/some_property "true"
- 列出所有配置属性:
- 重置gcloud配置到默认状态
若无法定位具体问题属性,可备份后重置配置:
重新配置Dataproc参数后重试任务。# 备份当前配置 gcloud config configurations export my-config-backup # 创建并激活新的默认配置 gcloud config configurations create default-reset gcloud config configurations activate default-reset - 更新gcloud SDK到最新版本
旧版本可能存在已知bug,执行更新:gcloud components update - 检查任务提交脚本
确认提交任务的脚本中,所有传递给gcloud的参数均为字符串格式,避免直接传入布尔类型值。
内容的提问来源于stack exchange,提问作者Poorna Noothalapati
相关产品推荐
相关产品推荐

