Repository navigation
Zeta:Spark 作业驱动日志归档(终态抓取 + 列表优先读归档 + 截断 + 7 天清理) - #258
Merged
todosdev[bot] merged 2 commits intoNov 29, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
livy_batches登记,正文设 512KB/10000 行上限、超限保留尾部并标注截断,7 天后只清正文、登记行保留。WAKER_SIGNING_KEY三态定时任务承载清理(官方 Cron 默认 / waker 回调 /false无调度),waker 回调按组织冻结契约 v2 实现。Changes
归档核心(worker)
worker/src/lib/migrations.ts:schema_v11给livy_batches增log_body/log_truncated/log_archived_at;schema_v12新增waker_executions幂等账本。worker/src/lib/log-archive.ts(新增):truncateLogTail(行+字节上限、保尾部、O(n))、pruneArchivedLogs(7 天只清正文)。worker/src/routes/livy.ts:新增archiveDriverLog,在refreshBatchStatus/settleBatchStatus/ 详情 / 删除四处终态落定后经c.executionCtx.waitUntil(...)后台归档;GET .../log改为终态且已归档时直读归档(archived/truncated标志),否则实时转 Livy。worker/src/types.ts:LivyBatchRow增三列;Env增WAKER_SIGNING_KEY?。定时任务三态 + waker 回调(tech-scheme §8)
worker/src/lib/waker.ts(新增):WAKER_SIGNING_KEY三态归一化(normalizeKey)、冻结契约 v2 验签(v2=前缀 +X-Waker-Timestamp/Execution-Id/Job-Id/Signature+ 300s 窗口 + HMAC-SHA256 常量时间比对)、executionId去重账本。任务名log-archive-cleanup(需在平台侧注册)。worker/src/index.ts:POST /_waker/execute回调路由(fail-closed 400/401/404/500 状态码、duplicate回放)、scheduled()三态让路。worker/wrangler.toml+worker/scripts/patch-wrangler.mjs:提交态[triggers] crons = [];按CRON_SCHEDULE/WAKER_SIGNING_KEY物化 cron。.github/workflows/deploy.yml:patch 步注入CRON_SCHEDULE/WAKER_SIGNING_KEY;secrets 文件按「有值才写入」条件并入WAKER_SIGNING_KEY。worker/src/lib/db.ts:tables()增waker_executions,并修复detectExistingTableFamily因executions是waker_executions后缀导致的前缀误判(按长度降序匹配)。前端(仅截断标注)
web/src/types.ts/web/src/pages/SparkJobs.tsx/web/src/lib/translations.ts:LivyBatchLog增truncated/archived;归档日志跳过二次取尾并显示「已截断」标注(中英文案)。测试
patch-wranglercron 物化;schema_v11/schema_v12迁移断言,及因新增表而调整的表族计数(15→16)断言。Testing
cd worker && pnpm type-check→ 通过。cd worker && pnpm test→ 1149 passed / 2 skipped;仅 9 个既有 live 集成测试失败(spark-live/spark-cancel-live需真实 Spark 服务,本环境无,与本次改动无关)。cd web && pnpm type-check && pnpm test→ 445 passed。pnpm format:check(仓库根)→ 通过。