-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Low-Code Concurrent CDK): Make SimpleRetriever thread-safe so that different partitions can share the same SimpleRetriever #185
Open
brianjlai
wants to merge
6
commits into
main
Choose a base branch
from
brian/default_paginator_thread_safe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ef51643
Refactor retrievers, paginators, and pagination strategy to be stateless
brianjlai 96e6cb1
solve problem with connector builder server test reads, rework record…
brianjlai 74e4b5e
more test edge cases and code cleanup
brianjlai 65ca401
Merge branch 'main' into brian/default_paginator_thread_safe
brianjlai 9ac92bf
some comments
brianjlai c704a22
remove unneeded class
brianjlai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,27 +24,32 @@ class Paginator(ABC, RequestOptionsProvider): | |
""" | ||
|
||
@abstractmethod | ||
def reset(self, reset_value: Optional[Any] = None) -> None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reseting can be deprecated now that these classes are stateless. We do however need to add the ability to get the initial token value for different types of pagination strategies |
||
def get_initial_token(self) -> Optional[Any]: | ||
""" | ||
Reset the pagination's inner state | ||
Get the page token that should be included in the request to get the first page of records | ||
""" | ||
|
||
@abstractmethod | ||
def next_page_token( | ||
self, response: requests.Response, last_page_size: int, last_record: Optional[Record] | ||
self, | ||
response: requests.Response, | ||
last_page_size: int, | ||
last_record: Optional[Record], | ||
last_page_token_value: Optional[Any], | ||
) -> Optional[Mapping[str, Any]]: | ||
""" | ||
Returns the next_page_token to use to fetch the next page of records. | ||
|
||
:param response: the response to process | ||
:param last_page_size: the number of records read from the response | ||
:param last_record: the last record extracted from the response | ||
:param last_page_token_value: The current value of the page token made on the last request | ||
:return: A mapping {"next_page_token": <token>} for the next page from the input response object. Returning None means there are no more pages to read in this response. | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def path(self) -> Optional[str]: | ||
def path(self, next_page_token: Optional[Mapping[str, Any]]) -> Optional[str]: | ||
""" | ||
Returns the URL path to hit to fetch the next page of records | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also highlighting this. I'd love for the connector builder server's usage of the PaginatorTestReadDecorator to be stateless too, but I couldn't think of a good way of making the page count limit cut avoid storing state. And I didn't want to block getting this fix out either. If anyone has a clever solution for this.
We probably need need to solve this when we move the builder server to use the concurrent source