Pipeline options documentation has typos and does not show how to use user-defined the options.
Link:
https://beam.apache.org/documentation/programming-guide/#configuring-pipeline-options
1) Python and Go snippets incorrectly end with an example from Java tab: "Now your pipeline can accept --myCustomOption=value as a command-line argument."
2) The page does not show how users can actually access the values of these user-defined options.
cc: [~melap], [~rtnguyen] [~altay]
Imported from Jira BEAM-7007. Original Jira may contain additional context. Reported by: tvalentyn.
Needs further investigation to see if this is still relevant.
@tvalentyn, since you reported the original Jira: half of this is fixed, and I would like to check the plan for the other half before sending a PR.
- Fixed: the closing sentence of 2.1.2 Creating custom options is no longer Java-specific. It now reads "Now your pipeline can accept
--input=valueand--output=valueas command-line arguments." - Still open: the section shows how to define custom options in each SDK but never how to read the values back.
view_asdoes not appear anywhere underwebsite/www/site/content/en/documentation/, and the Java tab stops at.as(MyOptions.class).
Proposed change, docs only:
- After that sentence, add a short paragraph, "Accessing custom option values", with a tab for each SDK:
- Python: a new tagged snippet in
sdks/python/apache_beam/examples/snippets/snippets.pythat buildsPipelineOptionsfrom a list of args, callsbeam_options.view_as(MyOptions), reads.inputand.output, and has a test insnippets_test.py. - Java: an inline example,
options.getInput(), matching the inline Java examples already in that section. - Go: a snippet in
sdks/go/examples/snippets/01_03intro.goshowing that the values are read by dereferencing the flag variables (*input) afterbeam.Init()/flag.Parse().
- Python: a new tagged snippet in
- No change to TypeScript or YAML.
Does that scope and placement work for you, or would you prefer something smaller, such as a one-line pointer to the WordCount walkthrough? I will hold off on a PR until I hear back.
.take-issue
i think there is already a link to a sample:
Note: The WordCount example pipeline demonstrates how to set pipeline options at runtime by using command-line options.
Thanks @tvalentyn, that makes sense. The WordCount walkthrough covers reading the values back, so I'll drop this one.
.free-issue