BugFix: Resolve PolicyFlashlb warm up function attribute error (#4741)
## Description Fix the AttributeError caused by incorrect invocation of the warm-up function in the FlashLB algorithm: 1. **Root Cause**: The warm-up function for FlashLB is defined outside the `PolicyFlashlb` class (not a class method), but the code incorrectly attempted to call it via the `PolicyFlashlb` class instance. 2. **Key Fix**: Clarify the invocation rule for FlashLB: when selecting the FlashLB algorithm, the warm-up function must be called in advance to precompile and warm up the algorithm (invoked as a standalone function), instead of calling it through the `PolicyFlashlb` class. 3. **Impact**: Resolve the runtime error when using FlashLB, ensure the algorithm pre-compilation/warm-up process works as expected, and avoid attribute missing exceptions. Signed-off-by: Mercykid-bash <ruanche0218@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from .policy_abstract import DynamicConfig, EplbPolicy
|
||||
from .policy_dynamic_ep import DynamicEplb
|
||||
from .policy_dynamic_ep_v2 import DynamicEplbV2
|
||||
from .policy_flashlb import FlashLB
|
||||
from .policy_flashlb import FlashLB, warm_up
|
||||
from .policy_random import RandomLoadBalance
|
||||
|
||||
|
||||
@@ -29,5 +29,5 @@ class PolicyFactory:
|
||||
policy_class = policy.get(policy_type, RandomLoadBalance)
|
||||
policy_instance = policy_class(config)
|
||||
if policy_type == 3:
|
||||
policy_instance.warm_up()
|
||||
return policy_instance
|
||||
warm_up()
|
||||
return policy_instance
|
||||
|
||||
Reference in New Issue
Block a user