Add manual routing policy for router (#15586)
This commit is contained in:
@@ -21,6 +21,7 @@ def policy_from_str(policy_str: Optional[str]) -> PolicyType:
|
||||
"cache_aware": PolicyType.CacheAware,
|
||||
"power_of_two": PolicyType.PowerOfTwo,
|
||||
"bucket": PolicyType.Bucket,
|
||||
"manual": PolicyType.Manual,
|
||||
}
|
||||
return policy_map[policy_str]
|
||||
|
||||
|
||||
@@ -171,21 +171,28 @@ class RouterArgs:
|
||||
f"--{prefix}policy",
|
||||
type=str,
|
||||
default=RouterArgs.policy,
|
||||
choices=["random", "round_robin", "cache_aware", "power_of_two"],
|
||||
choices=["random", "round_robin", "cache_aware", "power_of_two", "manual"],
|
||||
help="Load balancing policy to use. In PD mode, this is used for both prefill and decode unless overridden",
|
||||
)
|
||||
parser.add_argument(
|
||||
f"--{prefix}prefill-policy",
|
||||
type=str,
|
||||
default=None,
|
||||
choices=["random", "round_robin", "cache_aware", "power_of_two", "bucket"],
|
||||
choices=[
|
||||
"random",
|
||||
"round_robin",
|
||||
"cache_aware",
|
||||
"power_of_two",
|
||||
"manual",
|
||||
"bucket",
|
||||
],
|
||||
help="Specific policy for prefill nodes in PD mode. If not specified, uses the main policy",
|
||||
)
|
||||
parser.add_argument(
|
||||
f"--{prefix}decode-policy",
|
||||
type=str,
|
||||
default=None,
|
||||
choices=["random", "round_robin", "cache_aware", "power_of_two"],
|
||||
choices=["random", "round_robin", "cache_aware", "power_of_two", "manual"],
|
||||
help="Specific policy for decode nodes in PD mode. If not specified, uses the main policy",
|
||||
)
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ pub enum PolicyType {
|
||||
CacheAware,
|
||||
PowerOfTwo,
|
||||
Bucket,
|
||||
Manual,
|
||||
}
|
||||
|
||||
#[pyclass(eq)]
|
||||
@@ -267,6 +268,7 @@ impl Router {
|
||||
balance_rel_threshold: self.balance_rel_threshold,
|
||||
bucket_adjust_interval_secs: self.bucket_adjust_interval_secs,
|
||||
},
|
||||
PolicyType::Manual => ConfigPolicyConfig::Manual,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user