link_clusters
函数功能
KvCache管理模式的建链。
函数原型
link_clusters(clusters: Union[List[LLMClusterInfo], Tuple[LLMClusterInfo]], timeout=3000)
参数说明
| 参数名称 | 数据类型 | 取值说明 | 
|---|---|---|
| clusters | Union[List[LLMClusterInfo], Tuple[LLMClusterInfo]] | 集群列表。 | 
| timeout | int | 超时时间,单位:ms,默认超时时间3000ms。 | 
调用示例
from llm_datadist import LLMDataDist, LLMRole, LLMStatusCode, LLMClusterInfo
llm_datadist = LLMDataDist(LLMRole.DECODER, 0)
cluster = LLMClusterInfo()
cluster.remote_cluster_id = 1
cluster.append_local_ip_info("1.1.1.1", 26000)
cluster.append_remote_ip_info("1.1.1.1", 26000)
ret, rets = llm_datadist.link_clusters([cluster], 5000)
if ret != LLMStatusCode.LLM_SUCCESS:
    raise Exception("link failed.")
for cluster_i in range(len(rets)):
    link_ret = rets[cluster_i]
    if link_ret != LLMStatusCode.LLM_SUCCESS:
        print(f"{cluster_i} link failed.")
返回值
正常情况下返回两个值的元组,第一个值是接口的返回值,类型是LLMStatusCode,第二个是每个集群建链结果的列表,类型是LLMStatusCode。
参数错误可能抛出TypeError或ValueError。
约束说明
无
父主题: LLMDataDist