shunping commented on issue #33815:
URL: https://github.com/apache/beam/issues/33815#issuecomment-2816453840

   I also tried to implement the same logic in python as follows, but prism 
does not get stuck when running this pipeline.
   
   ```python
   import apache_beam as beam
   from apache_beam.options.pipeline_options import PipelineOptions
   from apache_beam.transforms.periodicsequence import PeriodicImpulse
   from apache_beam.transforms.window import FixedWindows
   from apache_beam.utils.timestamp import Timestamp
   
   options = PipelineOptions([
       "--job_server_timeout=600",
       "--environment_type=LOOPBACK",
       "--runner=PortableRunner",
       "--job_endpoint=localhost:8073",
   ])
   
   class InitCount(beam.DoFn):
     def process(self, element):
       return [1]
   
   class PlusOne(beam.DoFn):
     def process(self, element):
       print(element)
       return [element + 1]
   
   HALF_MAX_TIMESTAMP = Timestamp(
     micros=2147483647 * 1000 / 2 )
   
   duration=5
   fixed_window = FixedWindows(size=duration)
   with beam.Pipeline(options=options) as p:
     unboundedSource1 = p | "s1" >> PeriodicImpulse(fire_interval=duration)
     unboundedSource2 = p | "s2" >> 
PeriodicImpulse(start_timestamp=HALF_MAX_TIMESTAMP, fire_interval=duration)
   
     trigger1 = unboundedSource1 | "w1" >> beam.WindowInto(fixed_window)
     trigger2 = unboundedSource1 | "w2" >> beam.WindowInto(fixed_window)
   
     c1 = trigger1 | "i1" >> beam.ParDo(InitCount())
     c2 = trigger2 | "i2" >> beam.ParDo(InitCount())
     _ = ([c1, c2] | beam.Flatten() | "p1" >> beam.ParDo(PlusOne()) | "p2" >> 
beam.ParDo(PlusOne())) | "p3" >> beam.ParDo(PlusOne())
   
   ```


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

Reply via email to