[Docs] Document UnboundedSource in the Python I/O connector guide - #39529
[Docs] Document UnboundedSource in the Python I/O connector guide#39529Eliaaazzz wants to merge 2 commits into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Assigning reviewers: R: @damccorm for label website. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
8e5b2cb to
f5f2f74
Compare
f5f2f74 to
01821a4
Compare
The guide covered only the bounded BoundedSource and RangeTracker path. Add the UnboundedSource, UnboundedReader, and CheckpointMark sections, plus an example source and the Read and ReadFromUnboundedSource entry points. Group the source classes under "Implementing the Source subclass" and the reader classes under "Implementing the RangeTracker and UnboundedReader subclasses" so the page nests the same way as the Java guide.
01821a4 to
ff50ad4
Compare
| You can find `BoundedSource` and `RangeTracker` in the | ||
| [apache_beam.io.iobase module](https://beam.apache.org/releases/pydoc/{{< param release_latest >}}/apache_beam.io.iobase.html), | ||
| and the unbounded classes in the | ||
| [apache_beam.io.unbounded_source module](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/unbounded_source.py). |
There was a problem hiding this comment.
Let's use https://beam.apache.org/releases/pydoc/ website. This PR won't be merged until Beam 2.76.0 released, at that time pydoc website is updated to have unbounded_source
There was a problem hiding this comment.
Thanks for the pointer. I switched it to the pydoc link with the release_latest param. It will resolve once 2.76.0 is out.
| ### Implementing the Source subclass | ||
|
|
||
| ### Implementing the BoundedSource subclass | ||
| You must create a subclass of either `BoundedSource` or `UnboundedSource`, |
There was a problem hiding this comment.
"You must ..." often used as SKILLs for agents. The audience of Beam documentation is both human (and agents). Consider a plain tense: Create a subclass of .... Check this throughout the change.
There was a problem hiding this comment.
Thanks for the tip. I reworded to plain tense and checked the rest of the change for You must phrasing. I kept the two sentences saying your subclass must override the following methods, since they match the existing BoundedSource and RangeTracker sections word for word. Happy to reword those as well if you prefer.
Documents
UnboundedSourcein the Python I/O connector development guide, mirroring theUnboundedSourcecoverage in the Java guide.The guide currently describes only the bounded
BoundedSource/RangeTrackerpath, so theUnboundedSource,UnboundedReader, andCheckpointMarkclasses added in #38724 are undocumented on the website.What changes
UnboundedSourcealongsideBoundedSource, and names the reader and checkpoint-mark classes each one needs.split,create_reader,get_checkpoint_mark_coder, the optionaldefault_output_coder, and the absence of a per-record dedup hook (useDeduplicateafter the read).start,advance,get_current,get_current_timestamp,get_watermark,get_checkpoint_mark,close, including the distinction between "no data right now" and aMAX_TIMESTAMPend of stream.create_reader, and the idempotence requirement onfinalize_checkpoint.beam.io.Read, and thepoll_interval/max_records_per_bundle/max_read_time_secondsknobs onReadFromUnboundedSource.The example was run on the DirectRunner against a fake queue before being added:
beam.io.Read(QueueSource(...))emits the expected records and, thanks to thedefault_output_coderoverride, types the outputPCollectionasbytes.This replaces the earlier revision of this PR, which described how to write an unbounded Splittable DoFn instead of documenting the
UnboundedSourceAPI.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md