How do I drain a pipeline from within another pipeline?

后端 未结 1 1430
花落未央
花落未央 2021-01-01 02:53

I need to programmatically drain a pipeline from within another pipeline. The DataflowPipelineJob class doesn\'t have a drain method implemented. I

1条回答
  •  生来不讨喜
    2021-01-01 03:55

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

    0 讨论(0)
提交回复
热议问题