davidcavazos commented on code in PR #1: URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r897068572
########## my_app/app.py: ########## @@ -0,0 +1,27 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +from typing import Callable, Optional +import apache_beam as beam +from apache_beam.options.pipeline_options import PipelineOptions + + +def run( + input_text: str, + beam_options: Optional[PipelineOptions] = None, + test: Callable[[beam.PCollection], None] = lambda _: None, +) -> None: + with beam.Pipeline(options=beam_options) as pipeline: + elements = ( + pipeline + | "Create elements" >> beam.Create(["Hello", "World!", input_text]) + | "Print elements" >> beam.Map(lambda x: print(x) or x) Review Comment: You're right, actually we can just mock the print function to the identity function in the tests, so we can call print directly from here. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
