You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2022/06/03 20:27:00 UTC

[jira] [Commented] (BEAM-4232) ValueProvider with default value fails using DirectRunner

    [ https://issues.apache.org/jira/browse/BEAM-4232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17546983#comment-17546983 ] 

Kenneth Knowles commented on BEAM-4232:
---------------------------------------

This issue has been migrated to https://github.com/apache/beam/issues/18789

> 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
>            Priority: P3
>
>  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
(v8.20.7#820007)