Waterfall Engine and Scaling Policy#579
Merged
sharpener6 merged 8 commits intofinos:mainfrom Mar 11, 2026
Merged
Conversation
5ed23c2 to
0cf85fe
Compare
|
@gxuu, the name should be |
src/scaler/scheduler/controllers/policies/advance_policy/scaling/utility.py
Outdated
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/advance_policy/scaling/utility.py
Outdated
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/waterfall_v1/scaling/waterfall.py
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/waterfall_v1/scaling/waterfall.py
Outdated
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/waterfall_v1/scaling/waterfall.py
Outdated
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/waterfall_v1/scaling/waterfall.py
Outdated
Show resolved
Hide resolved
src/scaler/scheduler/controllers/policies/simple_policy/scaling/types.py
Outdated
Show resolved
Hide resolved
sharpener6
reviewed
Mar 3, 2026
983560e to
53486f2
Compare
sharpener6
reviewed
Mar 4, 2026
sharpener6
reviewed
Mar 4, 2026
sharpener6
reviewed
Mar 4, 2026
5ee75f9 to
77b69ac
Compare
4f294c7 to
211d8b2
Compare
sharpener6
reviewed
Mar 11, 2026
Introduces an "advance" policy engine with a waterfall scaling strategy that cascades worker scaling across prioritized adapters. Priority-1 adapters fill first; overflow goes to priority-2, then priority-3. Shutdown is reversed. - Add workerAdapterID (Data) to WorkerAdapterHeartbeat protocol - Extend ScalingController interface with worker_adapter_snapshots parameter - WorkerAdapterController builds cross-adapter snapshots from heartbeat state - Add WaterfallScalingController, AdvancePolicy, and supporting types/factories Signed-off-by: gxu <georgexu420@163.com>
- Route waterfall through VanillaPolicyController like all other policies - Remove create_policy_controller; add WATERFALL_V1 case to create_policy - Remove default value for worker_manager_id in WorkerManagerHeartbeat.new_msg - Rename WaterfallRule.worker_manager_id to adapter_id_prefix for clarity Signed-off-by: gxu <georgexu420@163.com>
- WaterfallRule.adapter_id_prefix -> worker_type (matches Worker Manager ID spec) - WaterfallRule.max_workers -> max_task_concurrency - Config format: priority,worker_type,max_task_concurrency - Update docstrings and comments to use worker_type terminology Signed-off-by: gxu <georgexu420@163.com>
Signed-off-by: gxu <georgexu420@163.com>
Signed-off-by: gxu <georgexu420@163.com>
Signed-off-by: gxu <georgexu420@163.com>
sharpener6
reviewed
Mar 11, 2026
src/scaler/scheduler/controllers/policies/waterfall_v1/scaling/waterfall.py
Outdated
Show resolved
Hide resolved
Signed-off-by: gxu <georgexu420@163.com>
sharpener6
approved these changes
Mar 11, 2026
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.
READY FOR REVIEW.
Waterfall_v1 engine and Waterfall Scaling Policy
Summary
Adds a new waterfall scaling policy that cascades worker scaling across prioritized worker managers. Priority-1 managers fill first; overflow goes to priority-2, then priority-3. Shutdown is reversed — least-preferred drains first. Offline managers are skipped automatically.
Configuration
Each line is
priority,worker_type,max_task_concurrency. Comments (#) and blank lines are supported. Worker types match worker manager IDs by prefix (e.g. worker_typenativematches manager IDnative|abc123). Effective capacity per manager ismin(config max_task_concurrency, heartbeat max_worker_groups).Changes
Protocol:
workerManagerID(Data) toWorkerManagerHeartbeatin Cap'n Proto schema (required, no default)<worker_type>|<uuid>:NAT|<pid>,ECS|<pid>,SYM|<pid>Scaling interface:
ScalingPolicy.get_scaling_commands()with aworker_manager_snapshotsparameter (Dict[bytes, WorkerManagerSnapshot]) providing cross-manager state to all policiesWorkerManagerControllerbuilds these snapshots from existing heartbeat tracking state via_build_manager_snapshots()WorkerManagerSnapshotdataclass tosimple_policy/scaling/types.pyPolicy layer:
WaterfallV1PolicyimplementsScalerPolicy(same asSimplePolicy), routed throughVanillaPolicyControllerviacreate_policy()VanillaPolicyControllerremains the onlyPolicyControllerimplementationWATERFALL_V1case tocreate_policy()factory inlibrary/utility.pyNew files:
waterfall_v1/waterfall_v1_policy.py—WaterfallV1Policy(ScalerPolicy)with even_load allocationwaterfall_v1/scaling/waterfall.py— StatelessWaterfallScalingPolicy(ScalingPolicy)with worker_type-based manager ID matchingwaterfall_v1/scaling/types.py—WaterfallRule(fields:priority,worker_type,max_task_concurrency)waterfall_v1/scaling/utility.py—parse_waterfall_rules()config parsertests/scheduler/test_waterfall_scaling.py— 25 unit tests