简体   繁体   中英

How do I drain a pipeline from within another pipeline?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM