【问题标题】:How to know when dataproc initialization actions are done如何知道 dataproc 初始化操作何时完成
【发布时间】: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

我的问题是:

  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 代理才能运行作业。

【问题讨论】:

  • 能否分享一下如何创建集群的命令以及您使用的 Dataproc 映像版本(使用次要版本,即 1.x.x)?
  • 当然,我用请求的信息编辑问题!

标签: google-cloud-dataproc


【解决方案1】:

至于知道初始化动作什么时候结束,你可以查看dataproc的status.state,如果是CREATING表示初始化动作还在执行,如果RUNNING表示初始化动作已经完成了! 检查here

【讨论】:

    【解决方案2】:
    1. 初始化操作成功后,Dataproc 代理在/var/log/google-dataproc-agent.0.log 文件中记录Custom initialization actions finished. 消息。

    2. 不,您不需要手动重新启动 Dataproc 代理。

    此问题由Dataproc agent service restart in the connectors initialization action 引起,应由this PR 解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-13
      • 2018-01-16
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多