如何知道dataproc初始化操作何时完成

问题描述 投票:0回答:1

我需要运行一个安装了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

我的问题是:

  1. 如何知道初始化操作已完成?
  2. 我是否有/如何在我新创建的集群节点中正确重启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代理才能运行作业。

google-cloud-dataproc
1个回答
1
投票
  1. 初始化操作成功后,Dataproc代理会在Custom initialization actions finished.文件中记录/var/log/google-dataproc-agent.0.log消息。
  2. 不,您不需要手动重新启动Dataproc代理。

这个问题是由Dataproc agent service restart in the connectors initialization action引起的,应该由this PR解决。

© www.soinside.com 2019 - 2024. All rights reserved.