google-cloud-dataflow - 使用 gcloud cli 执行 Dataflow 作业时出现“无法识别的参数”错误
问题描述
我在 Dataflow UI 中创建了一个工作,它工作正常。现在我想用一个小的 bash 脚本从命令行自动化它:
#GLOBAL VARIABLES
export PROJECT="cf-businessintelligence"
export GCS_LOCATION="gs://dataflow-templates/latest/Jdbc_to_BigQuery"
export MAX_WORKERS="15"
export NETWORK="businessintelligence"
export REGION_ID="us-central1"
export STAGING_LOCATION="gs://dataflow_temporary_directory/temp_dir"
export SUBNETWORK="bidw-dataflow-usc1"
export WORKER_MACHINE_TYPE="n1-standard-96"
export ZONE="us-central1-a"
export JOBNAME="test"
#COMMAND
gcloud dataflow jobs run $JOBNAME --project=$PROJECT --gcs-location=$GCS_LOCATION \
--max-workers=$MAX_WORKERS \
--network=$NETWORK \
--parameters ^:^query="select current_date":connectionURL="jdbc:mysql://mysqldbhost:3306/bidw":user="xyz",password="abc":driverClassName="com.mysql.jdbc.Driver":driverJars="gs://jdbc_drivers/mysql-connector-java-8.0.16.jar":outputTable="cf-businessintelligence:bidw.mytest":tempLocation="gs://dataflow_temporary_directory/tmp" \
--region=$REGION_ID \
--staging-location=$STAGING_LOCATION \
--subnetwork=$SUBNETWORK \
--worker-machine-type=$WORKER_MACHINE_TYPE \
--zone=$ZONE
当我运行它时,它失败并出现以下错误:
ERROR: (gcloud.dataflow.jobs.run) unrecognized arguments:
--network=businessintelligence
按照 中的说明gcloud topic escaping
,我相信我正确地转义了我的参数,所以我真的很困惑。为什么 NETWORK 参数失败?
解决方案
Try getting help for your command, to see which options are currently accepted by it:
gcloud dataflow jobs run --help
For me, this displays a number of options, but not the --network
option.
I then checked the beta
channel:
gcloud beta dataflow jobs run --help
And it does display the --network
option. So you'll want to launch your job with gcloud beta dataflow...
.
推荐阅读
- excel - 如何将行高和列宽从一个 Excel 文件复制到另一个
- kubernetes - 如何为类型配置自动缩放:对象
- ios - iOS 文本转语音:什么决定了 [AVSpeechSynthesisVoice voiceWithLanguage] 返回的默认语音?
- powershell - PowerShell:通过主机名创建脚本到 MSTSC,如果 DNS 失败,使用 IP
- dart - 如何从组件外部访问 TemplateRef
- javascript - 如何在包含图片和 URL 的 LI 项目的组件内创建 React Loop?
- javascript - 在javascript中匹配字符串中数字之前和字符串中数字之后的所有文本
- c - 我尝试在 AVL 树中实现插入,但是当我尝试运行它时出现分段错误。
- jquery - 单击组合时多个类元素的 JQuery 切换
- immutable.js - Immutable.js:这是预期的 hashCode 冲突还是错误?