无法使用 PubsubIO.Read 创建管道,资源设置...失败
Unable to create Pipeline with PubsubIO.Read, Set up of resource ... failed
我的测试管道非常简单。它尝试读取通过控制台创建的主题。
public static void main(String[] args) throws IOException {
Options options = PipelineOptionsFactory.fromArgs(args).
withValidation().as(Options.class);
options.setStreaming(true);
Pipeline pipeline = Pipeline.create(options);
PCollection<String> input = pipeline
.apply(PubsubIO.Read.topic(options.getPubsubTopic()))
.apply(ParDo.of(new ExtractEvents()));
pipeline.run();
}
当我尝试执行此管道时出现以下错误:
Workflow failed. Causes: (de5f777e2e08c1d9): Step
setup_resource_additionaltopic.subscription-375367840492394866711: Set
up of resource additionaltopic.subscription-3753678404923948667 failed
Dataflow 控制台也报告内部错误:
我在文档中找不到任何内容,我尝试和错误地尝试解决此问题也没有成功。
解决方案
要 运行 Dataflow 作业,项目必须启用以下 Google Cloud Platform APIs:
- Google 云数据流 API
- 计算引擎API(Google计算引擎)
- Google 云日志记录 API
- Google 云存储
- Google 云存储 JSON API
- BigQuery API
- Google云Pub/Sub
- Google 云数据存储 API
您可以使用 Google 云平台控制台一次性 enable all 所需的 API。
您的项目似乎没有启用 Pubsub API。您是否阅读了入门指南中的说明,尤其是 APIs 上的部分。那里有一个 link 应该可以让你开始所需的一切。
您可能还需要验证 APIs 和权限是否已为数据流作业 运行 所在的项目正确设置,以访问您尝试订阅的 Pubsub 主题。
我的测试管道非常简单。它尝试读取通过控制台创建的主题。
public static void main(String[] args) throws IOException {
Options options = PipelineOptionsFactory.fromArgs(args).
withValidation().as(Options.class);
options.setStreaming(true);
Pipeline pipeline = Pipeline.create(options);
PCollection<String> input = pipeline
.apply(PubsubIO.Read.topic(options.getPubsubTopic()))
.apply(ParDo.of(new ExtractEvents()));
pipeline.run();
}
当我尝试执行此管道时出现以下错误:
Workflow failed. Causes: (de5f777e2e08c1d9): Step setup_resource_additionaltopic.subscription-375367840492394866711: Set up of resource additionaltopic.subscription-3753678404923948667 failed
Dataflow 控制台也报告内部错误:
我在文档中找不到任何内容,我尝试和错误地尝试解决此问题也没有成功。
解决方案
要 运行 Dataflow 作业,项目必须启用以下 Google Cloud Platform APIs:
- Google 云数据流 API
- 计算引擎API(Google计算引擎)
- Google 云日志记录 API
- Google 云存储
- Google 云存储 JSON API
- BigQuery API
- Google云Pub/Sub
- Google 云数据存储 API
您可以使用 Google 云平台控制台一次性 enable all 所需的 API。
您的项目似乎没有启用 Pubsub API。您是否阅读了入门指南中的说明,尤其是 APIs 上的部分。那里有一个 link 应该可以让你开始所需的一切。
您可能还需要验证 APIs 和权限是否已为数据流作业 运行 所在的项目正确设置,以访问您尝试订阅的 Pubsub 主题。