mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-14 06:30:57 +00:00
fix(cloud): restore plugins and pipeline execution (#2379)
Co-authored-by: dadachann <185672915+dadachann@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ dependencies = [
|
|||||||
"chromadb>=1.0.0,<2.0.0",
|
"chromadb>=1.0.0,<2.0.0",
|
||||||
"qdrant-client (>=1.15.1,<2.0.0)",
|
"qdrant-client (>=1.15.1,<2.0.0)",
|
||||||
"pyseekdb==1.1.0.post3",
|
"pyseekdb==1.1.0.post3",
|
||||||
"langbot-plugin @ git+https://github.com/langbot-app/langbot-plugin-sdk.git@1d65ed301a6afc52150a998043f73cd6032c8162",
|
"langbot-plugin @ git+https://github.com/langbot-app/langbot-plugin-sdk.git@101e453e916b39465a6294d6471c9eaae8725d5c",
|
||||||
"asyncpg>=0.30.0",
|
"asyncpg>=0.30.0",
|
||||||
"line-bot-sdk>=3.19.0",
|
"line-bot-sdk>=3.19.0",
|
||||||
"matrix-nio>=0.25.2",
|
"matrix-nio>=0.25.2",
|
||||||
|
|||||||
@@ -132,9 +132,7 @@ class Controller:
|
|||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if selected_query: # 找到了
|
if not selected_query: # 没找到 说明:没有请求 或者 所有query对应的session都已达到并发上限
|
||||||
queries.remove(selected_query)
|
|
||||||
else: # 没找到 说明:没有请求 或者 所有query对应的session都已达到并发上限
|
|
||||||
await self.ap.query_pool.condition.wait()
|
await self.ap.query_pool.condition.wait()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from sqlalchemy.ext.asyncio import create_async_engine
|
|||||||
from langbot.pkg.persistence.mgr import PersistenceManager, PersistenceMode
|
from langbot.pkg.persistence.mgr import PersistenceManager, PersistenceMode
|
||||||
from langbot.pkg.persistence.tenant_uow import PersistenceScopeKind
|
from langbot.pkg.persistence.tenant_uow import PersistenceScopeKind
|
||||||
from langbot.pkg.pipeline.controller import Controller
|
from langbot.pkg.pipeline.controller import Controller
|
||||||
|
from langbot.pkg.pipeline.pool import QueryPool
|
||||||
from langbot.pkg.workspace.errors import WorkspaceGenerationMismatchError
|
from langbot.pkg.workspace.errors import WorkspaceGenerationMismatchError
|
||||||
|
|
||||||
|
|
||||||
@@ -143,3 +144,31 @@ async def test_controller_revalidates_generation_before_running_pipeline(
|
|||||||
runtime_pipeline.run.assert_awaited_once_with(sample_query)
|
runtime_pipeline.run.assert_awaited_once_with(sample_query)
|
||||||
query_pool.remove_query.assert_awaited_once_with(sample_query)
|
query_pool.remove_query.assert_awaited_once_with(sample_query)
|
||||||
session._semaphore.release.assert_called_once_with()
|
session._semaphore.release.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_controller_schedules_query_without_removing_it_twice(mock_app, sample_query):
|
||||||
|
query_pool = QueryPool()
|
||||||
|
query_pool.queries.append(sample_query)
|
||||||
|
mock_app.query_pool = query_pool
|
||||||
|
mock_app.sess_mgr.get_session = AsyncMock(return_value=SimpleNamespace(_semaphore=asyncio.Semaphore(1)))
|
||||||
|
|
||||||
|
scheduler_errors: list[str] = []
|
||||||
|
|
||||||
|
def stop_on_scheduler_error(message):
|
||||||
|
scheduler_errors.append(str(message))
|
||||||
|
raise asyncio.CancelledError
|
||||||
|
|
||||||
|
def stop_after_scheduling(process_coro, **_kwargs):
|
||||||
|
process_coro.close()
|
||||||
|
raise asyncio.CancelledError
|
||||||
|
|
||||||
|
mock_app.logger.error.side_effect = stop_on_scheduler_error
|
||||||
|
mock_app.task_mgr.create_task.side_effect = stop_after_scheduling
|
||||||
|
controller = Controller(mock_app)
|
||||||
|
|
||||||
|
with pytest.raises(asyncio.CancelledError):
|
||||||
|
await controller.consumer()
|
||||||
|
|
||||||
|
assert scheduler_errors == []
|
||||||
|
assert query_pool.queries == []
|
||||||
|
|||||||
@@ -2116,7 +2116,7 @@ requires-dist = [
|
|||||||
{ name = "ebooklib", specifier = ">=0.18" },
|
{ name = "ebooklib", specifier = ">=0.18" },
|
||||||
{ name = "gewechat-client", specifier = ">=0.1.5" },
|
{ name = "gewechat-client", specifier = ">=0.1.5" },
|
||||||
{ name = "html2text", specifier = ">=2024.2.26" },
|
{ name = "html2text", specifier = ">=2024.2.26" },
|
||||||
{ name = "langbot-plugin", git = "https://github.com/langbot-app/langbot-plugin-sdk.git?rev=1d65ed301a6afc52150a998043f73cd6032c8162" },
|
{ name = "langbot-plugin", git = "https://github.com/langbot-app/langbot-plugin-sdk.git?rev=101e453e916b39465a6294d6471c9eaae8725d5c" },
|
||||||
{ name = "langchain", specifier = ">=1.3.9" },
|
{ name = "langchain", specifier = ">=1.3.9" },
|
||||||
{ name = "langchain-core", specifier = ">=1.3.3" },
|
{ name = "langchain-core", specifier = ">=1.3.3" },
|
||||||
{ name = "langchain-text-splitters", specifier = ">=1.1.2" },
|
{ name = "langchain-text-splitters", specifier = ">=1.1.2" },
|
||||||
@@ -2182,8 +2182,8 @@ dev = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langbot-plugin"
|
name = "langbot-plugin"
|
||||||
version = "0.4.18"
|
version = "0.5.0"
|
||||||
source = { git = "https://github.com/langbot-app/langbot-plugin-sdk.git?rev=1d65ed301a6afc52150a998043f73cd6032c8162#1d65ed301a6afc52150a998043f73cd6032c8162" }
|
source = { git = "https://github.com/langbot-app/langbot-plugin-sdk.git?rev=101e453e916b39465a6294d6471c9eaae8725d5c#101e453e916b39465a6294d6471c9eaae8725d5c" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiofiles" },
|
{ name = "aiofiles" },
|
||||||
{ name = "aiohttp" },
|
{ name = "aiohttp" },
|
||||||
|
|||||||
Reference in New Issue
Block a user