generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 11
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: adds persistence layer for app state and job results [SBK-363] #45
Merged
Merged
Changes from 8 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
c46ec08
feat: adds persistence layer for app state and job results
mikeshultz b956d48
style(lint): fix imports
mikeshultz 7ba2f71
fix: fix types
mikeshultz 85a5579
style(lint): disagreement flake8 didn't like black output
mikeshultz ec43642
refactor: adds silverback_startup task, and on_client_* and on_worker…
mikeshultz 8d2427c
fix: add missing silverback_shutdown task exec in runner
mikeshultz 2564382
style(lint): lint rolling
mikeshultz e4caa59
refactor: remove unused SilverbackApp.checkpoint() method
mikeshultz 8be2d10
refactor: remove mongo, add sqlite
mikeshultz 82cb68e
fix: type | None is new in 3.10
mikeshultz c420f49
fix: forgot to save...
mikeshultz 7e9e67a
style: minor cleanup and docstrings
mikeshultz 134748d
style(lint): where that pre-commit hook when you need it
mikeshultz f58911a
fix: call to self.network.__enter__ should be before we try and touch…
mikeshultz 0506ad5
feat(cli): adds simple `worker` command
mikeshultz 2d67e49
docs: move example, create redis example, update README
mikeshultz 98a7adb
fix(style): remove unused import
mikeshultz 19a458b
style(lint): chill, mypy
mikeshultz 4bb23c8
fix: update examples to fix taskiq issue
mikeshultz 4d50d4c
style(lint): b0rk b0rk b0rk b0rk
mikeshultz 2d219b1
fix: worker command now uses broker app uses
mikeshultz 9273cb0
refactor: simplify app strings for examples
mikeshultz f7059c4
fix: drop pickle for security, use generic types for HandlerResult re…
mikeshultz 7dc5bd0
refactor: HandlerResult should subclass TaskiqResult
mikeshultz c300fb6
docs: update docs for worker events, new on_startup behavior, nad ela…
mikeshultz e96e4f2
refactor: use position arg for reasons
mikeshultz 29fa6ce
fix: surface errors in persistence when saving results
mikeshultz a544e33
refactor: move results persistence calls to middleware
mikeshultz 00b2bf9
Merge branch 'main' into feat/persistence
mikeshultz e8dcda3
Update silverback/_cli.py
mikeshultz ee76273
refactor: use lazy init and not require runner or whatever to have to…
mikeshultz 9779c4b
Merge branch 'feat/persistence' of github.com:ApeWorX/silverback into…
mikeshultz 0f1f7f2
fix: run all requested workers
mikeshultz 8dfb17c
fix: wut
mikeshultz a0d1c20
docs: add section covering distributed configuration
mikeshultz e32297d
refactor: remove PERSISTENCE_URI, use first-class SQLITE_PATH
mikeshultz a7b0719
fix: leftover PERSISTENCE_URI in settings type
mikeshultz 3892e13
refactor: minor cleanup of unused settings arg in BasePersistentStorage
mikeshultz db7cce6
docs: help string update
mikeshultz 60c4fd1
refactor: remove on_client_* silverback decorators
mikeshultz f35048c
refactor: storage->store
mikeshultz 40a2041
refactor: instance_state -> state
mikeshultz 0f630b0
fix: remove unnecessary Union types
mikeshultz 4a6a65a
Merge branch 'feat/persistence' of github.com:ApeWorX/silverback into…
mikeshultz ccc96d8
refactor(docs): move back to unified example script
mikeshultz ee51bec
docs(refactor): fix example reference
mikeshultz 463f8f6
docs: add 0.2.0 notes on event handler decorator behavior changes
mikeshultz f7e44c5
docs: update for multi-process configuration
mikeshultz 4f0b11b
docs: arg clarity
mikeshultz 5bf000c
refactor: SilverbackIdent -> SilverbackID
mikeshultz 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from .application import SilverbackApp | ||
from .exceptions import CircuitBreaker, SilverbackException | ||
from .types import SilverbackStartupState | ||
|
||
__all__ = [ | ||
"CircuitBreaker", | ||
"SilverbackApp", | ||
"SilverbackException", | ||
"SilverbackStartupState", | ||
] |
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.
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.
what are the pros/cons of moving the startup/shutdown handlers into separate tasks from the worker startup/shutdown events
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.
They cannot be combined. They're very separate things.
Having
on_startup
be a worker event means unexpected duplication of execution. Having a separate task also allows us to feed the handler useful information, likelast_block_*
. This is basically what we need for ApePay.Renaming the previous handlers to be explicit worker event handlers implies their actual usage and is clearer, IMO. They're two distinct things.
The only real con is we're changing up behavior here. Anyone setting up worker state may need to refactor.
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.
but won't this mean that only one worker will handle this event on startup? vs. the worker startup event is executed on every worker as it's set up?
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.
yes.
on_startup
will only run once upon runner startup.on_worker_startup
will run on every worker startup.