无法使用PubsubIO.Read创建管道,设置资源...失败 [英] Unable to create Pipeline with PubsubIO.Read, Set up of resource ... failed

查看:51
本文介绍了无法使用PubsubIO.Read创建管道,设置资源...失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的测试管道非常简单.它尝试读取通过控制台创建的主题.

My test pipeline is really simple. It attempts to read from a topic created via the console.

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();

}

当我尝试执行此管道时,出现以下错误:

When I attempt to execute this pipeline I get the following error:

工作流程失败.原因:(de5f777e2e08c1d9):步骤 setup_resource_additionaltopic.subscription-375367840492394866711:设置 资源的附加topic.subscription-3753678404923948667失败

Workflow failed. Causes: (de5f777e2e08c1d9): Step setup_resource_additionaltopic.subscription-375367840492394866711: Set up of resource additionaltopic.subscription-3753678404923948667 failed

Dataflow控制台还报告内部错误:

The Dataflow console also reports an internal error:

我在文档中找不到任何内容,并且为解决此问题而进行的尝试和错误尝试均未成功.

I can't find anything in the documentation and my trial and error attempts at resolving this haven't been successful.

解决方案

要运行数据流作业,项目必须启用以下Google Cloud Platform API:

To run a Dataflow job, a project must enable the following Google Cloud Platform APIs:

  • Google Cloud Dataflow API
  • Compute Engine API(Google Compute Engine)
  • Google Cloud Logging API
  • Google云存储
  • Google云存储JSON API
  • BigQuery API
  • Google Cloud Pub/Sub
  • Google Cloud Datastore API

您可以使用Google Cloud Platform Console来

You can use the Google Cloud Platform Console to enable all the required APIs at once.

推荐答案

您的项目似乎未启用Pubsub API.您是否已阅读入门指南中的说明,尤其是 API 上的部分.那里有一个链接,该链接应该可以使您开始使用所需的一切.

It looks like your project doesn't have the Pubsub API enabled. Have you gone through the instructions in the getting started guide, especially the part on APIs. There is a link there that should enable everything you need to get going.

您可能还需要验证为运行Dataflow作业的项目正确设置了API和权限,以访问您要订阅的Pubsub主题.

You may also need to verify that the APIs and permissions are properly setup for the project that the Dataflow job is running in to access the Pubsub topic you are trying to subscribe to.

这篇关于无法使用PubsubIO.Read创建管道,设置资源...失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆