Files
CloudLab Deploy 4c312cac39
CloudLab CI/CD / 门禁 doctor (push) Failing after 38s
CloudLab CI/CD / 单元测试 (push) Skipped
CloudLab CI/CD / 归档完整性 (push) Skipped
CloudLab CI/CD / 构建站点与归档 (push) Skipped
CloudLab CI/CD / 部署到 lab.hdtime.space(rsync) (push) Skipped
CloudLab CI/CD / 构建镜像并推送 Gitea 容器仓库 (push) Skipped
CloudLab CI/CD / 容器部署到 lab.hdtime.space (push) Skipped
CloudLab CI/CD / 发布版本(Tag) (push) Skipped
feat(platform): add CloudLab execution platform and IDE web source
Freeze the real-execution control plane, runner, manifests, validation cases and tests under cloudlab-platform; preserve the IDE/static web source under cloudlab-web. Generated material library and runtime state are intentionally excluded.
2026-11-18 00:14:35 +08:00

48 lines
4.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
from pathlib import Path
p = Path('/root/dsh_workspace/cloudlab-platform/docs/RESEARCH.md')
s = p.read_text(encoding='utf-8')
s = s.replace('测试分三组:', '测试分四组:')
s = s.replace(
'''`tests/test_admission.py` 用内存 SQLite 校验单账号活动运行计数与排队位置(终态运行不占配额)。''',
'''`tests/test_admission.py` 用内存 SQLite 校验单账号活动运行计数与排队位置(终态运行不占配额);`tests/test_worker_lease.py` 校验领取时写入租约与 attempt、心跳续租、过期运行恢复为 failed(跳过本机 active 与未过期运行),以及恢复幂等、旧 worker 不能覆盖恢复后的终态。''')
s = s.replace('当前结果:34 个测试通过;', '当前结果:38 个测试通过;')
p.write_text(s, encoding='utf-8')
p = Path('/root/dsh_workspace/cloudlab-platform/docs/DISTRIBUTED.md')
s = p.read_text(encoding='utf-8')
s = s.replace(
'''| 执行 | `worker.py` 调 Docker,单机 | `MAX_RUNS=2`;`MAX_RUNS_PER_USER=2`,无跨节点池 |''',
'''| 执行 | `worker.py` 调 Docker,单机;领取时写 90 s 租约、3 s 心跳续租、15 s 扫描过期运行 | `MAX_RUNS=2`;`MAX_RUNS_PER_USER=2`;无跨节点池、无多 worker 重领 |''')
s = s.replace(
'''10 万在线仍需 Redis/队列/worker lease/租户限流。''',
'''10 万在线仍需 Redis/队列/多 worker 调度/租户限流;单 worker 租约与孤儿恢复已实现。''')
s = s.replace(
'''- `runs`(status, queue, priority, quota, idempotency_key, worker_id, heartbeat)''',
'''- `runs`(status, queue, priority, quota, idempotency_key, lease_owner, lease_expires_at, attempt, worker_id, heartbeat)''')
s = s.replace(
'''| worker 心跳缺失 | 30 s 标记失联,任务重领 |''',
'''| worker 心跳缺失 | 租约 90 s 过期后标记 failed,按容器 label 清理;重领/requeue 尚未实现 |''')
s = s.replace(
'''| worker 崩溃 | 心跳超时 → 任务回到 queued;容器按 label 清理 |''',
'''| worker 崩溃 | 租约过期 → 运行标记 failed(不自动回到 queued);容器按 label 清理;重跑需重新提交 |''')
s = s.replace(
'''5. worker 心跳与失联重领;容器 label 清理。''',
'''5. worker 心跳与失联恢复:已实现单 worker 租约(90 s)、心跳续租、过期运行标记 failed 与容器 label 清理;多 worker 重领/requeue 仍属 M2。''')
s = s.replace(
'''- 未做 GPU/HPC 调度。''',
'''- 未做 GPU/HPC 调度。\n- 未做多 worker 调度与跨节点重领(当前单 worker 租约只会把孤儿运行标记 failed,不会自动 requeue)。''')
p.write_text(s, encoding='utf-8')
p = Path('/root/dsh_workspace/cloudlab-app/host-README.md')
s = p.read_text(encoding='utf-8')
s = s.replace(
'''(34 个测试,含 test_admission 的活动运行计数与排队位置,DATA-01 的分布形状、BCa 与自动列选择,以及 BIO-03 的中性精确转移矩阵/H_t/Wilson/bootstrap 断言)''',
'''(38 个测试,含 test_admission 的活动运行计数与排队位置、test_worker_lease 的租约/孤儿恢复断言,DATA-01 的分布形状、BCa 与自动列选择,以及 BIO-03 的中性精确转移矩阵/H_t/Wilson/bootstrap 断言)''')
old = '''- 单账号准入:同一账号最多同时保留 2 个活动运行(运行中 + 排队,MAX_RUNS_PER_USER);超额提交由 POST /api/runs 返回 429 `quota_exceeded`,不插入运行。排队运行详情带 `queue.position/ahead/total`,队列按 created_at,rowid(同秒按插入顺序);这是单账号安全阀,不是公平调度、项目租户配额或资源预留。'''
new = old + '''\n- 执行租约:worker 领取运行时写 `lease_owner/lease_expires_at`(默认 90 s)、`attempt+1`;心跳每 3 s 续租;启动与每 15 s 扫描过期 running,将其标记 failed 并按容器 label 清理。终态写回要求 status 为 running 且租约仍属本 worker,避免旧 worker 覆盖恢复结果;过期运行不会自动 requeue,重跑需重新提交。多 worker 重领尚未实现。'''
s = s.replace(old, new)
s = s.replace('''`GET /api/runs/:id` 的排队运行带 `queue`。''', '''`GET /api/runs/:id` 的排队运行带 `queue`,运行对象带 `attempt`。''')
p.write_text(s, encoding='utf-8')
print('docs updated')