mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-22 02:07:13 +00:00
style: format Cloud runtime readiness fixes
This commit is contained in:
@@ -326,10 +326,13 @@ class Application:
|
|||||||
async def run(self):
|
async def run(self):
|
||||||
self.event_loop_monitor.start()
|
self.event_loop_monitor.start()
|
||||||
try:
|
try:
|
||||||
if self.directory_projection_service is not None and getattr(self, "directory_projection_task", None) is None:
|
if (
|
||||||
|
self.directory_projection_service is not None
|
||||||
|
and getattr(self, 'directory_projection_task', None) is None
|
||||||
|
):
|
||||||
self.directory_projection_task = self.task_mgr.create_task(
|
self.directory_projection_task = self.task_mgr.create_task(
|
||||||
self.directory_projection_service.run(),
|
self.directory_projection_service.run(),
|
||||||
name="cloud-directory-projection",
|
name='cloud-directory-projection',
|
||||||
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
||||||
)
|
)
|
||||||
if self.cloud_model_catalog_service is not None:
|
if self.cloud_model_catalog_service is not None:
|
||||||
@@ -344,6 +347,7 @@ class Application:
|
|||||||
name='cloud-manifest-refresh',
|
name='cloud-manifest-refresh',
|
||||||
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
||||||
)
|
)
|
||||||
|
|
||||||
# 后续可能会允许动态重启其他任务
|
# 后续可能会允许动态重启其他任务
|
||||||
# 故为了防止程序在非 Ctrl-C 情况下退出,这里创建一个不会结束的协程
|
# 故为了防止程序在非 Ctrl-C 情况下退出,这里创建一个不会结束的协程
|
||||||
async def never_ending():
|
async def never_ending():
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class BuildAppStage(stage.BootingStage):
|
|||||||
# its long-lived tasks, so start the single refresh task here.
|
# its long-lived tasks, so start the single refresh task here.
|
||||||
ap.directory_projection_task = ap.task_mgr.create_task(
|
ap.directory_projection_task = ap.task_mgr.create_task(
|
||||||
ap.directory_projection_service.run(),
|
ap.directory_projection_service.run(),
|
||||||
name="cloud-directory-projection",
|
name='cloud-directory-projection',
|
||||||
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
scopes=[core_entities.LifecycleControlScope.APPLICATION],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -701,7 +701,9 @@ class PluginRuntimeConnector(ManagedRuntimeConnector):
|
|||||||
}
|
}
|
||||||
self._known_desired_states.update({state.binding.installation_uuid: state for state in desired_states})
|
self._known_desired_states.update({state.binding.installation_uuid: state for state in desired_states})
|
||||||
|
|
||||||
reconcile_timeout_seconds = max(300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get("plugin", {})))
|
reconcile_timeout_seconds = max(
|
||||||
|
300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get('plugin', {}))
|
||||||
|
)
|
||||||
result = await runtime_handler.reconcile_plugin_installations(
|
result = await runtime_handler.reconcile_plugin_installations(
|
||||||
tuple(self._known_desired_states.values()),
|
tuple(self._known_desired_states.values()),
|
||||||
timeout=reconcile_timeout_seconds,
|
timeout=reconcile_timeout_seconds,
|
||||||
@@ -740,7 +742,9 @@ class PluginRuntimeConnector(ManagedRuntimeConnector):
|
|||||||
if state.binding.installation_uuid in all_states:
|
if state.binding.installation_uuid in all_states:
|
||||||
raise ValueError('Duplicate plugin installation UUID across projected Workspaces')
|
raise ValueError('Duplicate plugin installation UUID across projected Workspaces')
|
||||||
all_states[state.binding.installation_uuid] = state
|
all_states[state.binding.installation_uuid] = state
|
||||||
reconcile_timeout_seconds = max(300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get("plugin", {})))
|
reconcile_timeout_seconds = max(
|
||||||
|
300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get('plugin', {}))
|
||||||
|
)
|
||||||
result = await runtime_handler.reconcile_plugin_installations(
|
result = await runtime_handler.reconcile_plugin_installations(
|
||||||
tuple(all_states.values()),
|
tuple(all_states.values()),
|
||||||
timeout=reconcile_timeout_seconds,
|
timeout=reconcile_timeout_seconds,
|
||||||
|
|||||||
Reference in New Issue
Block a user