How to get PipelineOptions in composite PTransform in Beam 2.0?

Viewed 2955

After upgrading to Beam 2.0 the Pipeline class doesn't have getOptions() class anymore. I have a composite PTransform that relies on getting the options in the its expand method:

public class MyCompositeTransform extends PTransform<PBegin, PDone> {
    @Override
    public PDone expand(PBegin input) {
        Pipeline pipeline = input.getPipeline();
        MyPipelineOptions options = pipeline.getOptions().as(MyPipelineOptions.class);
        ...
    }
}

In Beam 2.0 there doesn't seem to be a way to access the PipelineOptions at all in the expand method.

What's the alternative?

1 Answers
Related