【发布时间】:2019-02-09 12:03:38
【问题描述】:
我需要运行一个安装了 BigQuery 和 Cloud Storage 连接器的 Dataproc 集群。
我使用this script 的变体(因为我无法访问一般使用的存储桶),一切正常,但是当我运行作业时,当集群启动并运行时,它总是会导致Task was not acquired 错误。
我可以通过简单地在每个节点上重新启动 dataproc 代理来解决此问题,但我确实需要它才能正常工作,以便能够在我的集群创建后立即运行作业。看来这部分脚本运行不正常:
# Restarts Dataproc Agent after successful initialization
# WARNING: this function relies on undocumented and not officially supported Dataproc Agent
# "sentinel" files to determine successful Agent initialization and not guaranteed
# to work in the future. Use at your own risk!
restart_dataproc_agent() {
# Because Dataproc Agent should be restarted after initialization, we need to wait until
# it will create a sentinel file that signals initialization competition (success or failure)
while [[ ! -f /var/lib/google/dataproc/has_run_before ]]; do
sleep 1
done
# If Dataproc Agent didn't create a sentinel file that signals initialization
# failure then it means that initialization succeded and it should be restarted
if [[ ! -f /var/lib/google/dataproc/has_failed_before ]]; then
service google-dataproc-agent restart
fi
}
export -f restart_dataproc_agent
# Schedule asynchronous Dataproc Agent restart so it will use updated connectors.
# It could not be restarted sycnhronously because Dataproc Agent should be restarted
# after its initialization, including init actions execution, has been completed.
bash -c restart_dataproc_agent & disown
我的问题是:
- 如何知道初始化动作已经完成?
- 我是否拥有/如何正确重启 Dataproc 代理到我新创建的集群节点之一?
编辑: 这是我用来创建集群的命令(使用 1.3 镜像版本):
gcloud dataproc --region europe-west1 \
clusters create my-cluster \
--bucket my-bucket \
--subnet default \
--zone europe-west1-b \
--master-machine-type n1-standard-1 \
--master-boot-disk-size 50 \
--num-workers 2 \
--worker-machine-type n1-standard-2 \
--worker-boot-disk-size 100 \
--image-version 1.3 \
--scopes 'https://www.googleapis.com/auth/cloud-platform' \
--project my-project \
--initialization-actions gs://dataproc-initialization-actions/connectors/connectors.sh \
--metadata 'gcs-connector-version=1.9.6' \
--metadata 'bigquery-connector-version=0.13.6'
另外,请注意,连接器初始化脚本已经修复并且现在可以正常工作,所以我现在正在使用它,但我仍然需要手动重新启动 dataproc 代理才能运行作业。
【问题讨论】:
-
能否分享一下如何创建集群的命令以及您使用的 Dataproc 映像版本(使用次要版本,即 1.x.x)?
-
当然,我用请求的信息编辑问题!