beam icon indicating copy to clipboard operation
beam copied to clipboard

Pipeline options documentation has typos and does not show how to use user-defined the options.

Open kennknowles opened this issue 4 years ago • 4 comments

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.

kennknowles avatar Jun 04 '22 03:06 kennknowles

Needs further investigation to see if this is still relevant.

pcoet avatar Jun 23 '22 18:06 pcoet

@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.

  1. 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=value and --output=value as command-line arguments."
  2. Still open: the section shows how to define custom options in each SDK but never how to read the values back. view_as does not appear anywhere under website/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.py that builds PipelineOptions from a list of args, calls beam_options.view_as(MyOptions), reads .input and .output, and has a test in snippets_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.go showing that the values are read by dereferencing the flag variables (*input) after beam.Init()/flag.Parse().
  • 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

jonathansudhakar1 avatar Nov 02 '26 17:11 jonathansudhakar1

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.

tvalentyn avatar Nov 05 '26 01:11 tvalentyn

Thanks @tvalentyn, that makes sense. The WordCount walkthrough covers reading the values back, so I'll drop this one.

.free-issue

jonathansudhakar1 avatar Nov 05 '26 17:11 jonathansudhakar1