refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
## 总体架构:双执行模式 {#_1-总体架构-双执行模式}
|
||||
|
||||
WeKnora 有两种任务执行模式,通过部署形态选择:
|
||||
Academy 有两种任务执行模式,通过部署形态选择:
|
||||
|
||||
- **asynq 模式(标准部署)**:任务经 `asynq.Client` 序列化为 JSON payload 写入 Redis 队列,由多个独立的 `asynq.Server`(worker pool)消费。`internal/router/task.go` 中 `RunAsynqServer()` 构建统一的 `asynq.ServeMux` 并在 6 个 pool 上运行。
|
||||
- **Lite 模式(单机 / macOS App,无 Redis)**:`internal/router/sync_task.go` 的 `SyncTaskExecutor` 实现同一个 `interfaces.TaskEnqueuer` 接口,`Enqueue` 直接把任务派发到 goroutine 执行,支持 `ProcessIn` / `ProcessAt`(延迟)、`MaxRetry`、`Timeout` 与 `Deadline` 选项,写在 `asynq.NewTask` 或 `Enqueue` 上都生效(后者优先)。没有设置超时的任务不限时,这一点与 asynq 默认 30 分钟不同。重试为线性退避(`attempt * 5s`,上限 30s),返回 `asynq.SkipRetry` 的任务不再重试。handler 内的 panic 会被捕获并按失败处理,不会导致进程退出。重试耗尽后执行与标准模式死信回调相同的收尾:文档类任务会把知识标为 `failed`。
|
||||
@@ -27,7 +27,7 @@ WeKnora 有两种任务执行模式,通过部署形态选择:
|
||||
| 多模态子任务计数器 | 图片子任务完成计数(DECR),最后一个 attempt 触发 finalize;Lite 模式改用进程内计数器 | `image_multimodal` 相关服务 |
|
||||
| 限流 | 滑动窗口限流 ZSET(见可观测性文档) | `internal/ratelimit/limiter.go` |
|
||||
|
||||
Redis 连接参数来自环境变量 `REDIS_ADDR` / `REDIS_USERNAME` / `REDIS_PASSWORD` / `REDIS_DB` / TLS 配置。读写超时由 `WEKNORA_REDIS_OP_TIMEOUT_MS` 控制,默认 500ms(写超时为其 2 倍以吸收队头阻塞):
|
||||
Redis 连接参数来自环境变量 `REDIS_ADDR` / `REDIS_USERNAME` / `REDIS_PASSWORD` / `REDIS_DB` / TLS 配置。读写超时由 `ACADEMY_REDIS_OP_TIMEOUT_MS` 控制,默认 500ms(写超时为其 2 倍以吸收队头阻塞):
|
||||
|
||||
```go
|
||||
// internal/router/task.go
|
||||
@@ -85,12 +85,12 @@ opt := &asynq.RedisClientOpt{
|
||||
|
||||
| Pool | 默认并发 | 消费队列(权重) | 配置键 / 环境变量 |
|
||||
| --- | --- | --- | --- |
|
||||
| `core` | 8 | `default`(1)、`chat_attachment`(3) | `asynq.core_concurrency` / `WEKNORA_ASYNQ_CORE_CONCURRENCY` |
|
||||
| `postprocess` | 2 | `postprocess`(1) | `asynq.postprocess_concurrency` / `WEKNORA_ASYNQ_POSTPROCESS_CONCURRENCY` |
|
||||
| `enrichment` | 12 | `summary`(2)、`multimodal`(1)、`graph`(1)、`question`(1)、`memory`(1) | `asynq.enrichment_concurrency` / `WEKNORA_ASYNQ_ENRICHMENT_CONCURRENCY` |
|
||||
| `maintenance` | 4 | `sync`(2)、`low`(1) | `asynq.maintenance_concurrency` / `WEKNORA_ASYNQ_MAINTENANCE_CONCURRENCY` |
|
||||
| `shared`(弹性层) | 6 | core + enrichment 中 `SharedWeight > 0` 的队列 | `asynq.shared_concurrency` / `WEKNORA_ASYNQ_SHARED_CONCURRENCY` |
|
||||
| `wiki` | 8 | `wiki`(1) | `asynq.wiki_concurrency` / `WEKNORA_WIKI_ASYNQ_CONCURRENCY` |
|
||||
| `core` | 8 | `default`(1)、`chat_attachment`(3) | `asynq.core_concurrency` / `ACADEMY_ASYNQ_CORE_CONCURRENCY` |
|
||||
| `postprocess` | 2 | `postprocess`(1) | `asynq.postprocess_concurrency` / `ACADEMY_ASYNQ_POSTPROCESS_CONCURRENCY` |
|
||||
| `enrichment` | 12 | `summary`(2)、`multimodal`(1)、`graph`(1)、`question`(1)、`memory`(1) | `asynq.enrichment_concurrency` / `ACADEMY_ASYNQ_ENRICHMENT_CONCURRENCY` |
|
||||
| `maintenance` | 4 | `sync`(2)、`low`(1) | `asynq.maintenance_concurrency` / `ACADEMY_ASYNQ_MAINTENANCE_CONCURRENCY` |
|
||||
| `shared`(弹性层) | 6 | core + enrichment 中 `SharedWeight > 0` 的队列 | `asynq.shared_concurrency` / `ACADEMY_ASYNQ_SHARED_CONCURRENCY` |
|
||||
| `wiki` | 8 | `wiki`(1) | `asynq.wiki_concurrency` / `ACADEMY_WIKI_ASYNQ_CONCURRENCY` |
|
||||
|
||||
设计要点(源码注释均可佐证):
|
||||
|
||||
@@ -101,7 +101,7 @@ opt := &asynq.RedisClientOpt{
|
||||
|
||||
### 容量估算与扩容 {#capacity-planning}
|
||||
|
||||
旧聚合配置 `asynq.concurrency` / `WEKNORA_ASYNQ_CONCURRENCY` 已停用,存量部署应改为上表的各池配置。设置修改后需要重启服务。默认前五个池合计每实例 32 个 worker,Wiki 的 8 个另外计算。
|
||||
旧聚合配置 `asynq.concurrency` / `ACADEMY_ASYNQ_CONCURRENCY` 已停用,存量部署应改为上表的各池配置。设置修改后需要重启服务。默认前五个池合计每实例 32 个 worker,Wiki 的 8 个另外计算。
|
||||
|
||||
可以用下面的估算作为起点,再以运行时面板和实际负载调整:
|
||||
|
||||
@@ -299,9 +299,9 @@ stateDiagram-v2
|
||||
|
||||
### 兜底:housekeeping 清扫 {#_7-3-兜底-housekeeping-清扫}
|
||||
|
||||
`internal/application/service/knowledge_housekeeping.go`:cron 每 5 分钟(`0 */5 * * * *`)运行一轮,是 asynq 重试、死信回调、multimodal finalize 之外的最后防线(worker 被 kill 在 handler 中间、defer 没跑到等场景)。可用 `WEKNORA_HOUSEKEEPING_ENABLED=false` 关闭。
|
||||
`internal/application/service/knowledge_housekeeping.go`:cron 每 5 分钟(`0 */5 * * * *`)运行一轮,是 asynq 重试、死信回调、multimodal finalize 之外的最后防线(worker 被 kill 在 handler 中间、defer 没跑到等场景)。可用 `ACADEMY_HOUSEKEEPING_ENABLED=false` 关闭。
|
||||
|
||||
阈值为 `max(1h, WEKNORA_DOCUMENT_PROCESS_TIMEOUT) + 10min`。每轮包含:
|
||||
阈值为 `max(1h, ACADEMY_DOCUMENT_PROCESS_TIMEOUT) + 10min`。每轮包含:
|
||||
|
||||
| 清扫 | 对象 | 处理 |
|
||||
| --- | --- | --- |
|
||||
|
||||
Reference in new issue
Block a user