fix: 修复了严重bug
This commit is contained in:
parent
d17f6384fc
commit
7c841b9424
17
main.py
17
main.py
|
|
@ -35,8 +35,21 @@ async def start_system():
|
||||||
postgres_database = PostgresDatabase.options(name='postgres_database').remote()
|
postgres_database = PostgresDatabase.options(name='postgres_database').remote()
|
||||||
await postgres_database.init_db.remote()
|
await postgres_database.init_db.remote()
|
||||||
|
|
||||||
# 3. 启动全局状态机
|
global_state_machine = GlobalStateMachine.options(
|
||||||
GlobalStateMachine.options(name='global_state_machine').remote(postgres_database)
|
name='global_state_machine',
|
||||||
|
namespace='pretor',
|
||||||
|
lifetime='detached'
|
||||||
|
).remote(postgres_database)
|
||||||
|
|
||||||
|
print("正在等待 GlobalStateMachine 初始化并加载注册表...")
|
||||||
|
try:
|
||||||
|
# 强制执行初始化方法并阻塞等待结果。
|
||||||
|
# 如果 __init__ 或 init_state_machine 中有任何报错,会立刻在这里抛出!
|
||||||
|
await global_state_machine.init_state_machine.remote()
|
||||||
|
print("GlobalStateMachine 初始化成功!")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"\n[致命错误] GlobalStateMachine 启动失败!真实报错如下:\n{e}\n")
|
||||||
|
return
|
||||||
|
|
||||||
# 4. 启动核心节点
|
# 4. 启动核心节点
|
||||||
supervisory_node = SupervisoryNode.options(name='supervisory_node').remote()
|
supervisory_node = SupervisoryNode.options(name='supervisory_node').remote()
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,22 @@ from pretor.core.global_state_machine.individual_manager import GlobalIndividual
|
||||||
@ray.remote
|
@ray.remote
|
||||||
class GlobalStateMachine:
|
class GlobalStateMachine:
|
||||||
def __init__(self, postgres_database: PostgresDatabase):
|
def __init__(self, postgres_database: PostgresDatabase):
|
||||||
|
import sys
|
||||||
|
print("GSM __init__ START", file=sys.stderr, flush=True)
|
||||||
self.event_dict: Dict[str, PretorEvent] = {}
|
self.event_dict: Dict[str, PretorEvent] = {}
|
||||||
|
print(" event_dict done", file=sys.stderr, flush=True)
|
||||||
self._global_provider_manager = ProviderManager(postgres_database)
|
self._global_provider_manager = ProviderManager(postgres_database)
|
||||||
|
print(" provider_manager done", file=sys.stderr, flush=True)
|
||||||
self._global_tool_manager = GlobalToolManager()
|
self._global_tool_manager = GlobalToolManager()
|
||||||
|
print(" tool_manager done", file=sys.stderr, flush=True)
|
||||||
self._global_workflow_template_manager = WorkflowManager()
|
self._global_workflow_template_manager = WorkflowManager()
|
||||||
|
print(" workflow_template_manager done", file=sys.stderr, flush=True)
|
||||||
self._global_skill_manager = GlobalSkillManager()
|
self._global_skill_manager = GlobalSkillManager()
|
||||||
|
print(" skill_manager done", file=sys.stderr, flush=True)
|
||||||
self._global_individual_manager = GlobalIndividualManager()
|
self._global_individual_manager = GlobalIndividualManager()
|
||||||
|
print(" individual_manager done", file=sys.stderr, flush=True)
|
||||||
self.postgres_database = postgres_database
|
self.postgres_database = postgres_database
|
||||||
|
print("GSM __init__ DONE", file=sys.stderr, flush=True)
|
||||||
|
|
||||||
async def init_state_machine(self):
|
async def init_state_machine(self):
|
||||||
await self._global_provider_manager.init_provider_register(self.postgres_database)
|
await self._global_provider_manager.init_provider_register(self.postgres_database)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue