Auto Review and Downstream Polling #208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two classes that implement and encapsulate best-practices behavior for Auto Review and Downstream polling patterns. Combined with the
results
andetloutput
modules, this factors out much of the scaffolding of an Auto Review or Downstream pod.A project need only define one or both of these functions:
And instantiate one or both of the polling classes in a package's
__main__.py
, CLI, or other entrypoint:AutoReviewPoller
loads the result file and etl output as dataclasses, applies use-case-specific logic with theauto_review
callback, and submits the changes with optional STP.DownstreamPoller
loads the submission metadata, sends it downstream with thedownstream
callback, and marks the submission retrieved.Implemented best-practices behavior includes:
worker_count
kwarg.poll_delay
kwarg.retry_count
kwarg and friends.See examples/poll_auto_review.py and the class definitions for AutoReviewPoller and DownstreamPoller for more details.