You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 18:57:32 UTC

[GitHub] [beam] damccorm opened a new issue, #20676: Write just one file per window with WriteToFiles transform

damccorm opened a new issue, #20676:
URL: https://github.com/apache/beam/issues/20676

    In this case all message from Pub/Sub topic need accumulate in one text file per window, however  WriteToFiles produce many file instead one
   ```
   
   input = (p
                    | 'ReadData' >> beam.io.ReadFromPubSub(topic=known_args.input_topic).with_output_types(bytes)
   
                   | "Decode" >> beam.Map(lambda x: x.decode('utf-8'))
                    | 'Parse' >> beam.Map(parse_json)
   
                   | 'Data w' >> beam.WindowInto(
                       FixedWindows(60),
               
          trigger=trigger.AfterWatermark(),
                       accumulation_mode=AccumulationMode.DISCARDING
   
                  )
                    | 'Group elements into windows' >> beam.Reshuffle()
              
        )
   
           event_data = (input
                | 'Filter events' >> beam.Filter(lambda x: x['t']
   == 'event')
                | 'Encode ' >> beam.Map(lambda x: json.dumps(x))
                | 'Write to
   file's' >> fileio.WriteToFiles(
                       path='gs://some/gcs/bucket/',
                  
       file_naming=fileio.default_file_naming(
                           prefix='events',
               
              suffix='.txt'
                       ),
                       shards=1
                   )
   
          )
   
   ```
   
   
   Imported from Jira [BEAM-10998](https://issues.apache.org/jira/browse/BEAM-10998). Original Jira may contain additional context.
   Reported by: andy_ap.


-- 
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-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] gpintus commented on issue #20676: Write just one file per window with WriteToFiles transform

Posted by "gpintus (via GitHub)" <gi...@apache.org>.
gpintus commented on issue #20676:
URL: https://github.com/apache/beam/issues/20676#issuecomment-1597266764

   Hello.
   
   I got to understand that a temp file per bundle is created, and that the number and size of bundles is not a knob that can be regulated.
   
   This is a problem with high volume streaming, as the number of generated files per window can easily get out of hand. It is a problem i am facing in my current pipeline too. 


-- 
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-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org