-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[REF-1885] Shard Substates when serializing to Redis #2574
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0da630b
Move sharding internal to StateManager
masenf 0536308
WiP StateManager based sharding
masenf f4774cc
Copy the state __dict__ when serializing to avoid breaking the instance
masenf 9091fea
State tests need to pass the correct substate token for redis
masenf 9c271eb
state: when getting parent_state, set top_level=False
masenf f981b96
test_app: get tests passing with redis by passing the correct token
masenf 1af51a8
test_client_storage: look up substate key
masenf 521291a
state.py: pass static checks
masenf 658f540
test_dynamic_routes: working with redis state shard
masenf b130f6e
Update the remaining AppHarness tests to pass {token}_{state.get_full…
masenf ac72ca3
test_app: pass all tokens with state suffix
masenf b7e265e
StateManagerRedis: clean up commentary
masenf 498153d
Merge remote-tracking branch 'origin/main' into masenf/state-shard-re…
masenf 8d2ea15
Merge remote-tracking branch 'origin/main' into masenf/state-shard-re…
masenf 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
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
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 |
---|---|---|
|
@@ -41,6 +41,16 @@ class Event(Base): | |
# The event payload. | ||
payload: Dict[str, Any] = {} | ||
|
||
@property | ||
def substate_token(self) -> str: | ||
"""Get the substate token for the event. | ||
|
||
Returns: | ||
The substate token. | ||
""" | ||
substate = self.name.rpartition(".")[0] | ||
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. if we pull it out, then we can reuse the function here |
||
return f"{self.token}_{substate}" | ||
|
||
|
||
BACKGROUND_TASK_MARKER = "_reflex_background_task" | ||
|
||
|
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.
nit: maybe we can pull this out into a function
get_substater_token(token, handler)