dizzydroid commented on code in PR #35647:
URL: https://github.com/apache/beam/pull/35647#discussion_r2240698916
##########
website/www/site/content/en/documentation/transforms/python/other/waiton.md:
##########
@@ -30,27 +30,33 @@ import apache_beam as beam
from apache_beam.transforms.util import WaitOn
# Example 1: Basic usage
-with beam.Pipeline() as p:
+ with beam.Pipeline(options=pipeline_options) as p:
main = p | 'CreateMain' >> beam.Create([1, 2, 3])
- signal = (p | 'CreateSignal' >> beam.Create(['a', 'b', 'c'])
- | 'ProcessSignal' >> beam.Map(lambda x: time.sleep(2) or x))
+ signal = (
+ p | 'CreateSignal' >> beam.Create(['a', 'b'])
+ | 'ProcessSignal' >> beam.Map(lambda x: print(f"Processing signal
element: {x}") or time.sleep(2)))
# Wait for 'signal' to complete before processing 'main'
- # Elements [1, 2, 3] pass through unchanged after 'signal' finishes
result = main | 'WaitOnSignal' >> WaitOn(signal)
- result | beam.Map(print)
+
+ # Print each result to logs.
+ result | 'PrintExample1' >> beam.Map(lambda x: print(f"Example 1 Final
Output: {x}"))
# Example 2: Using multiple signals
-with beam.Pipeline() as p:
- main = p | 'CreateMain' >> beam.Create([1, 2, 3])
- signal1 = (p | 'CreateSignal1' >> beam.Create(['a', 'b', 'c'])
- | 'ProcessSignal1' >> beam.Map(lambda x: time.sleep(1) or
x.upper()))
- signal2 = (p | 'CreateSignal2' >> beam.Create(['x', 'y', 'z'])
- | 'ProcessSignal2' >> beam.Map(lambda x: time.sleep(3) or x *
2))
+ with beam.Pipeline(options=pipeline_options) as p:
Review Comment:
Nope, editor must have messed up. I have fixed this in 8fb2927, 9683238
--
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: github-unsubscr...@beam.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org