Introduce distributed planning lifecycle event handlers for replacing TaskEstimator - #564
Merged
Conversation
gabotechs
force-pushed
the
gabrielmusat/events
branch
2 times, most recently
from
July 23, 2026 18:17
63e1cab to
e240854
Compare
gabotechs
force-pushed
the
gabrielmusat/events
branch
2 times, most recently
from
July 27, 2026 07:37
fdbc9ba to
f4361cc
Compare
This was referenced Jul 27, 2026
gabotechs
force-pushed
the
gabrielmusat/events
branch
from
July 27, 2026 08:26
f760854 to
a4a9541
Compare
gabotechs
marked this pull request as ready for review
July 27, 2026 08:45
Collaborator
|
This PR pretty much LGTM. I got a good sense of it while working on #571. I'm good to merge that into this one and then merge this into main. |
gabotechs
force-pushed
the
gabrielmusat/events
branch
from
July 28, 2026 09:18
a4a9541 to
1871bb9
Compare
jayshrivastava
approved these changes
Jul 28, 2026
gabotechs
added a commit
that referenced
this pull request
Jul 31, 2026
## Stack 1. #564 2. #567 <- you are here 3. #568 4. #569 5. #570 --- Moves routing policy into ordered `RouteTasksHandler`s. Built-ins now cover child co-location, coordinator co-location, and randomized fallback, while custom handlers can override them. ```rust config.with_distributed_route_tasks_handler(|event| { Some(Ok(RouteTasksEventResponse::new( vec![worker_url.clone(); event.task_count], ))) }); ``` --------- Co-authored-by: Jayant Shrivastava <jshrivastava03@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack
Introduces an event-driven API for reacting to distributed planning lifecycle events, and replaces the previous TaskEstimator methods with it.
Motivation
TaskEstimatorinto a generic bucket for every planner lifecycle hook. For example Add dynamic stage built events #570.TaskEstimatorwas a convenient initial extension point, but its methods run at different points in planning, observe different context, and have different result semantics. Task-count estimation is evaluated while traversing the plan; leaf specialization only runs after a stage's final task count is known; routing runs later on the coordinator. Keeping these operations in one trait couples otherwise independent APIs.This event-specific pattern is easier to extend without breaking API consumers: a capability can evolve within the event that owns it instead of requiring every
TaskEstimatorimplementation to adopt a broader trait. It is also easier to document and expose to users. Dedicated event types give us focused API pages and code documentation, and provide a quick index of the project’s extension points by the planner lifecycle events where users can hook their code.What changed
Previously, one trait covered task-count estimation, leaf specialization, and task routing:
The old API registered one implementation containing every hook:
Those phases now have dedicated event handlers, which can be ordinary functions and are registered independently: