已合并
fix(executor): isolate bootstrap logs by runtime #8
fix(executor): isolate bootstrap logs by runtime #8
已合并
yipengfu创建于 8月21日
yipengfu
yipengfu成员
8月21日

Problem

Different instances of the same user can mount the same host log directory, so fixed bootstrap_cmd_.log paths mix output from multiple runtimes.

Changes

  • write bootstrap logs under ${GLOG_log_dir}/${YR_RUNTIME_ID}/
  • sanitize the runtime ID before using it as a path component
  • use unknown-runtime when the runtime ID is missing or unsafe
  • add unit tests and update the executor documentation
likedislike
Pull Request已成功合入, 合并人@songlicheng
(感谢 yipengfu 的贡献)
atomgit-bot
atomgit-bot
8月21日 评论:

变更摘要

本 PR 解决多用户实例挂载同一宿主日志目录时,固定 bootstrap_cmd_<index>.log 路径导致多个运行时输出互相混合的问题。改动将 executor/src/yr/agentexecutor/process_manager.py 中 ProcessManager 的引导日志写入路径从 ${GLOG_log_dir}/bootstrap_cmd_<index>.log 调整为 ${GLOG_log_dir}/${YR_RUNTIME_ID}/bootstrap_cmd_<index>.log,通过按运行时 ID 隔离日志目录,并在使用前对运行时 ID 做路径清洗,同时补充了单元测试并更新执行器文档。

主要改动

  • 新增 _runtime_log_directory 清洗函数: 使用正则 [^A-Za-z0-9._-] 将运行时 ID 中的不安全字符替换为 _,当 ID 为空、为 . 或 .. 时回退为 unknown-runtime,返回遍历安全的按运行时隔离的日志目录 Path(log_dir) / runtime_component。
  • ProcessManager.start 增加 runtime_id 参数: start 签名新增 runtime_id: str = "",日志目录创建与 bootstrap_cmd_<index>.log 的写入均改为在 runtime_log_directory 子目录下进行,实现不同运行时的日志输出隔离。
  • start_from_env 读取 YR_RUNTIME_ID 环境变量: 从环境变量 YR_RUNTIME_ID 获取运行时 ID 并透传给 start,空值时由清洗函数回退到 unknown-runtime。
  • 新增单元测试: 在 tests/executor/test_process_manager.py 中新增两条用例,分别验证 runtime ID 的路径清洗(如 ../runtime/id 被转换为 .._runtime_id)以及从环境变量读取 YR_RUNTIME_ID 时日志写入对应子目录,同时更新既有用例以断言 runtime-test 子目录下的日志内容。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月21日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
openJiuwen-bot成员
8月21日 评论:

欢迎来到 openJiuwen 社区

Hey @neatline , 感谢你对社区的贡献.

机器人使用手册

有关指令的使用,可以点击 此处 查看详情。开发人员可以在每个PR或Issue下方评论特定指令来触发机器人任务。

likedislike
atomgit-bot
atomgit-bot
8月21日 评论:

AtomGit AI 助手使用指南

在 PR 评论中使用命令即可触发。支持在普通评论和代码行评论中使用。

功能 命令 说明
代码审查 /ai review 检查代码质量、潜在问题、安全风险
PR 摘要 /ai summary 生成 PR 变更内容的结构化摘要
代码解释 /ai explain 解释代码变更的逻辑和意图
自由提问 @atomgit-bot <问题> 询问关于本 PR 的任何问题
帮助 /ai help 显示此帮助信息

免责声明

AI 助手可能存在误判,请结合自身判断。可以对评论点 👍 或 👎 帮助我们改进。

likedislike
不准确?
OopenJiuwen-bot成员
8月21日 添加了label:openJiuwen-cla/yes
openJiuwen-bot成员
8月21日 评论:

CLA 签署成功

neatline, 感谢您的代码贡献。 所有的代码贡献者都已完成了 CLA 签署。 👍

likedislike
openJiuwen-bot成员
8月21日 评论:

The pipeline(pipeline number:8) is running. Please wait a moment...

likedislike
OopenJiuwen-bot成员
8月21日 添加了label:ci-running
OopenJiuwen-bot成员
8月21日 删除了label:ci-running
openJiuwen-bot成员
8月21日 评论:
任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
likedislike
OopenJiuwen-bot成员
8月21日 添加了label:ci-successful
songlicheng
songlicheng成员
8月22日 评论:

/lgtm
/approve

likedislike
openJiuwen-bot成员
8月22日 评论:

Label Command Feedback

  • The label(s) **** permission is outside.
  • The label(s) approved permission is outside.
likedislike
songlichengsonglicheng成员
8月22日 合入了pull request,合并节点 SHA:a2b62c2c1de1609c130bdcd58fda76ab1b8974ef
OopenJiuwen-bot成员
8月22日 删除了label:ci-successful