Frank Yellin created BEAM-4232:
----------------------------------

             Summary: ValueProvider with default value fails using DirectRunner
                 Key: BEAM-4232
                 URL: https://issues.apache.org/jira/browse/BEAM-4232
             Project: Beam
          Issue Type: Bug
          Components: runner-dataflow
            Reporter: Frank Yellin
            Assignee: Thomas Groh


 The bug is shown by the following short piece of code. 
{code:java}
public class ShowProblem implements Serializable {
  public interface MyOptions 
         extends PipelineOptions, DataflowPipelineOptions {
      @Description("OutputFile")
      @Default.String("gs://xyzzy/helloWorld")
      ValueProvider<String> getOutput();
      void setOutput(ValueProvider<String> value);
    }
  public static void main(String args[]) {
    MyOptions options =  PipelineOptionsFactory.fromArgs(args)                  
    .as(MyOptions.class);
    Pipeline pipeline = Pipeline.create(options);
    pipeline
        .apply(Create.of("hello", "world", "!"))
        .apply(TextIO.write().to(options.getOutput()));
    pipeline.run();
  }
}

{code}
 If this pipeline is run with the "–output=gs://xyzzy/myfile" option, it runs 
fine both locally and on Google.  If this pipeline is run without the --option, 
it runs fine on Google, but fails when run locally.

When given an output argument, the ValueProvider returned by getOutput() is a 
StaticValueProvider; when using the default value returns a 
RuntimeValueProvider,   The latter seems to have a bug hinted at in the comment 
just above RuntimeValueProvider.get().  The code expects that when running the 
pipeline (and only when running the pipeline), someone has already called
{code:java}
RuntimeValueProvider.setRuntimeOptions(options){code}
There is apparently no call to this method when using a DirectRunner. 

 

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to