You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/03 20:26:16 UTC

[GitHub] [beam] kennknowles opened a new issue, #18789: ValueProvider with default value fails using DirectRunner

kennknowles opened a new issue, #18789:
URL: https://github.com/apache/beam/issues/18789

    The bug is shown by the following short piece of code. 
   ```
   
   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();
     }
   }
   
   
   ```
   
    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
   ```
   
   RuntimeValueProvider.setRuntimeOptions(options)
   ```
   
   There is apparently no call to this method when using a DirectRunner. 
   
    
   
    
   
    
   
    
   
   Imported from Jira [BEAM-4232](https://issues.apache.org/jira/browse/BEAM-4232). Original Jira may contain additional context.
   Reported by: fyellin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org