feat: 人设模板系统、节点调度标签、pydantic-settings收敛、错误处理增强
新增persona_template表和CRUD API,BaseIndividualModel增加node_affinity和template_origin_id字段, WorkerCluster支持多集群Ray资源调度,环境变量收敛到pydantic-settings统一校验, 数据库异常转换为结构化BusinessError/RetryableError,系统节点支持custom_system_prompt。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -125,3 +125,18 @@ def ray_actor_hook(*actor_names: str, timeout: float = 0.0, interval: float = 0.
|
||||
handle = _get_cached_actor_handle(actor_name)
|
||||
setattr(actor_list, actor_name, handle)
|
||||
return actor_list
|
||||
|
||||
|
||||
def get_worker_cluster(affinity: str = "cpu"):
|
||||
"""按 node_affinity 标签取对应的 WorkerCluster actor 句柄。
|
||||
|
||||
单机模式统一返回唯一的 worker_cluster 实例。
|
||||
分布式模式按 affinity 路由到 worker_cluster_cpu / _core / _gpu。
|
||||
未知标签降级到 cpu。
|
||||
"""
|
||||
if _STANDALONE:
|
||||
return _standalone_registry.get("worker_cluster")
|
||||
|
||||
_valid = {"cpu", "core", "gpu"}
|
||||
node_type = affinity if affinity in _valid else "cpu"
|
||||
return _get_cached_actor_handle(f"worker_cluster_{node_type}")
|
||||
|
||||
Reference in New Issue
Block a user