mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-21 04:42:01 +00:00
多进程端到端验收:scripts/test-multiprocess.sh 用本机 postgres:16 起临时库,tests/test_multiprocess_e2e.py(缺省跳过,AGENTLAB_MULTIPROCESS_E2E=1)在上面起两个 uvicorn 工作进程,用演示模型跑七个场景——两个进程都登记、一个当班;运行由接到请求的进程认领,另一个进程上的流收得到实时事件和流式增量,同一个审批决定同时发给两边只执行一次,两边事件流不重不漏、封存核对得上;跨进程停止;定时只触发一次;全站一个名额时评测的作答运行排着队,后来的问数据运行先拿到名额;两个进程同时记同一本每日账不越过上限;强杀一个进程后在跑的运行被照实标中断、停在审批上的照常在另一个进程上批完、当班交接。顺带修:等名额时被停止也照实收成已取消(以前停在排队中);当班的本地余量不超过租约的四分之一(租约调短时一直不当班);启动清理上传半成品时没有别的活着的进程就全清;文件锁守卫的几项测试只在 SQLite 跑;问数据事件日志清理那一拍不带时刻时按现在算
This commit is contained in:
@@ -136,6 +136,7 @@ def held_guard(store):
|
||||
table_versions._release_guard()
|
||||
|
||||
|
||||
@pytest.mark.sqlite_only # 文件锁守卫只在 SQLite(单进程)时有:PostgreSQL 可以多进程,版本存储靠跨进程的锁(app/cluster/mutex)
|
||||
async def test_read_only_process_refuses_writes_with_503_and_keeps_reads(client, held_guard):
|
||||
name = unique()
|
||||
base = await first_import(client, name, seed=505)
|
||||
@@ -170,6 +171,7 @@ async def test_read_only_process_refuses_writes_with_503_and_keeps_reads(client,
|
||||
assert await table_versions.expire_stagings(session) == []
|
||||
|
||||
|
||||
@pytest.mark.sqlite_only # 文件锁守卫只在 SQLite(单进程)时有:PostgreSQL 可以多进程,版本存储靠跨进程的锁(app/cluster/mutex)
|
||||
async def test_read_only_process_refuses_activate_and_commit_keeps_the_trial(client, held_guard):
|
||||
"""启用旧版本 503;提交 503 时不消耗试运行库(守卫拿回来之后照常提交)。"""
|
||||
name = unique()
|
||||
@@ -196,6 +198,7 @@ async def test_read_only_process_refuses_activate_and_commit_keeps_the_trial(cli
|
||||
assert resp.json()["parts"] == 3
|
||||
|
||||
|
||||
@pytest.mark.sqlite_only # 文件锁守卫只在 SQLite(单进程)时有:PostgreSQL 可以多进程,版本存储靠跨进程的锁(app/cluster/mutex)
|
||||
async def test_read_only_process_refuses_version_and_edit_writes_before_doing_any_work(client, held_guard, store,
|
||||
monkeypatch):
|
||||
"""只读进程:移除一期(要物化)、作废接受(累积模式,要物化)、edits/apply、edits/undo、POST /{id}/redraft 一律 503,
|
||||
@@ -253,6 +256,7 @@ async def test_read_only_process_refuses_version_and_edit_writes_before_doing_an
|
||||
assert len((await db_get(ImportStaging, applied["id"])).edits) == 1, "撤销没有生效"
|
||||
|
||||
|
||||
@pytest.mark.sqlite_only # 文件锁守卫只在 SQLite(单进程)时有:PostgreSQL 可以多进程,版本存储靠跨进程的锁(app/cluster/mutex)
|
||||
async def test_read_only_process_still_deletes_a_manual_source(client, held_guard):
|
||||
"""手工登记的源没有导入记录、配方、暂存区和隔离文件,不碰版本存储:只读进程里照常删除(9.1 只要求上传源 503)。"""
|
||||
sid = "manual-" + unique("m")
|
||||
|
||||
Reference in New Issue
Block a user