-
Notifications
You must be signed in to change notification settings - Fork 189
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(katana-tasks): task manager #2318
Conversation
WalkthroughOhayo, sensei! The recent changes enhance the asynchronous task management capabilities of the application. Key updates include upgrading the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TaskManager
participant TaskBuilder
participant CriticalTaskBuilder
User->>TaskManager: Request to spawn task
TaskManager->>TaskBuilder: Create new task
TaskBuilder->>TaskManager: Configure task parameters
TaskManager->>TaskManager: Spawn task
TaskManager->>User: Task is active
User->>TaskManager: Request cancellation
TaskManager->>TaskManager: Handle cancellation
TaskManager->>User: Task cancelled or completed
sequenceDiagram
participant User
participant CriticalTaskBuilder
User->>CriticalTaskBuilder: Request to spawn critical task
CriticalTaskBuilder->>CriticalTaskBuilder: Configure critical parameters
CriticalTaskBuilder->>User: Task is now running
User->>CriticalTaskBuilder: Await completion or cancellation
CriticalTaskBuilder->>User: Task completed or error handled
Recent review detailsConfiguration used: .coderabbit.yaml Files ignored due to path filters (1)
Files selected for processing (5)
Additional comments not posted (8)
TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2318 +/- ##
==========================================
+ Coverage 66.18% 67.31% +1.13%
==========================================
Files 352 354 +2
Lines 46739 46433 -306
==========================================
+ Hits 30933 31258 +325
+ Misses 15806 15175 -631 ☔ View full report in Codecov by Sentry. |
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.
Maybe not for now, but wondering at which point this could be re-used by different part of the stack, and not only Katana. :)
As this concept of having critical tasks auto-cancelling others for a graceful shutdown can actually be handy for long running processes like Torii or even Sozo could leverage that using multitasking for speeding up the migration process.
yeah agree i think this component is generic enough to be used outside the scope of katana. would be useful for something like torii that has to manage a bunch of async tasks at the same time. we should definitely use this (or a variation of it) in torii. this PR doesn't include integration into katana itself but i think implementing the task manger now would be helpful just to move katana bit by bit around the task management abstraction. if i am to integrate it now there would only be 1 task (ie node service) running inside the manager. something that i need to do is to separate the node service task into smaller individual tasks ie block production and messaging. later on the servers stuff should ideally be spawned in the manager as well. |
introduce a
TaskManager
struct to manage tasks that can be instrumented and cancelled for graceful shutdown. there is also a task builder associated with the task manager where a task can be configured to be:the idea is to spawn all main (critical) tasks (ie block production, messaging, servers, ... ) and be able to cancel the tasks for graceful shutdown (eg when a main task panicked).
Summary by CodeRabbit
New Features
TaskManager
for efficient management and cancellation of asynchronous tasks.TaskBuilder
andCriticalTaskBuilder
for flexible task configuration and error handling.Bug Fixes
Tests