tvalentyn commented on a change in pull request #14738:
URL: https://github.com/apache/beam/pull/14738#discussion_r626951504
##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -192,30 +188,21 @@ def model_pcollection(argv):
'The slings and arrows of outrageous fortune, ',
'Or to take arms against a sea of troubles, ',
]))
-
# [END model_pcollection]
- class MyOptions(PipelineOptions):
- @classmethod
- def _add_argparse_args(cls, parser):
- parser.add_argument(
- '--output',
- dest='output',
- required=True,
- help='Output file to write results to.')
-
- my_options = pipeline_options.view_as(MyOptions)
- lines | beam.io.WriteToText(my_options.output)
+ lines | beam.io.WriteToText(output_path)
-def pipeline_options_remote(argv):
+def pipeline_options_remote():
"""Creating a Pipeline using a PipelineOptions object for remote
execution."""
# [START pipeline_options_create]
- from apache_beam.options.pipeline_options import PipelineOptions
+ import sys
- options = PipelineOptions(flags=argv)
+ from apache_beam.options.pipeline_options import PipelineOptions
+ # If flags is None or not passed, it defaults to sys.argv
Review comment:
Why are we passing flags=sys.argv if this is the default?
If we'd like to demonstrate that it's possible to pass custom flags, we
could rephrase the comment, otherwise I'd simplify the snippet.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]