What I'd like to do is set my own defaults. One way of doing that, though a bit cumbersome would be by having an isXSet(), but as you said it would add a lot of methods and I'm not a huge fan.
Before I looked closer, I was expecting one of these things to work: 1. Being able to set a different default through extending the option classes in question, set @Defualt and pass that class to the factory like this: PipelineOptionsFactory.fromArgs(args).withValidation().as(MyPipelineOptions.class). 2. Being able to fill in a PipelineOptions instance before calling .fromArgs. That way I'd set my own defaults for the pipeline, but retain the ability to override them through the command line. On Wed, May 10, 2017 at 6:16 PM, Lukasz Cwik <[email protected]> wrote: > Your not missing anything. > > Are you speaking about being able to override defaults or being able to > see if the response from pipelineOptions.getY() is the default response? > Overriding defaults is tricky because many parts of the system call > options.getRunner(), now which default should be returned (what if two > other interfaces also provide a different default value that are not > related to each other)? > > The issue with seeing if a response is the default response is how do you > expect a caller to interact with it. For example we could: > * add a isRunnerSet() method, adds many methods to the interfaces > * ask whether something is default by name or by method reference, > options.isSet("runner" / method), brittle to any name changes in options. > > On Wed, May 10, 2017 at 5:44 AM, Rune Fevang <[email protected]> wrote: > >> I'd like to modify my pipeline to default to run in Dataflow, but still >> be settable to a different runner on the command line. As far as I can tell >> there's no way of doing this outside of parsing the command line myself: >> >> - Creating my own extended PipelineOptions class with a different >> @Default annotation doesn't work, it fails with a message saying @Default >> must match between PipelineOptions classes. >> - Calling options.setRunner() doesn't work, as it will override whatever >> is on the command line, and as far as I can tell there's no way of doing >> this before parsing the command line. >> - Calling options.getRunner() and only setting the runner when it's the >> default makes it so you can no longer use the DirectRunner, as there's no >> way of telling the difference between an unset option and one set to >> DirectRunner explicitly. >> >> Am I missing something? And if not is this a use-case it makes sense to >> accommodate? >> >> Thanks, >> Rune >> > >
