如何从另一个管道中排出管道? [英] How do I drain a pipeline from within another pipeline?

查看:195
本文介绍了如何从另一个管道中排出管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式从另一个管道中排出管道。 DataflowPipelineJob 类没有实现 drain 方法。是否可以使用Java API在管道上调用 drain

I need to programmatically drain a pipeline from within another pipeline. The DataflowPipelineJob class doesn't have a drain method implemented. Is it possible to call drain on a pipeline from with the Java API?

推荐答案

能够使用以下代码启动排水:

Was able to initiate draining with the following code:

    // spawn child pipe
    DataflowPipelineRunner runner = DataflowPipelineRunner.fromOptions(options);
    DataflowPipelineJob job = runner.run(p);

    // under the some condition later, drain the spawned pipe:
    Dataflow client = com.google.cloud.dataflow.sdk.util.Transport.newDataflowClient(options).build();
    Job content = new Job();
    content.setProjectId(options.getProject());
    content.setId(job.getJobId());
    content.setRequestedState("JOB_STATE_DRAINING");
    client.projects().jobs()
            .update(options.getProject(), job.getJobId(), content)
            .execute();

这篇关于如何从另一个管道中排出管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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