初始化LoadBalancing实例,获取健康检查数据和配置
(self)
| 124 | |
| 125 | class LoadBalancing: |
| 126 | def __init__(self) -> None: |
| 127 | """初始化LoadBalancing实例,获取健康检查数据和配置""" |
| 128 | # 这里要维护一个包含滑动窗口逻辑的, 每个供应商的每个模型的表现情况队列. |
| 129 | # 然后先按照损坏概率去降序排序. |
| 130 | # 再按照执行时间去降序排序. |
| 131 | self.healthy = Harness_localAPI.check_healthy() |
| 132 | self.source_price = source_price |
| 133 | self.source_ranking = source_ranking |
| 134 | self.source_mapping = source_mapping |
| 135 | # 添加日志记录器 |
| 136 | self.logger = logging.getLogger(__name__) |
| 137 | # 防止日志向上传播,避免重复打印 |
| 138 | self.logger.propagate = False |
| 139 | |
| 140 | |
| 141 | def _check_valid_model(self, source_name, model_name): |
nothing calls this directly
no test coverage detected