已合并
fix(executor): isolate bootstrap logs by runtime #8
yipengfu创建于 8月21日
fix(executor): isolate bootstrap logs by runtime #8
已合并
Pull Request已成功合入, 合并人@songlicheng
(感谢 yipengfu 的贡献)atomgit-bot
8月21日 评论:
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子目录下的日志内容。


不准确?
atomgit-bot
8月21日 评论:
8月21日 评论:
openJiuwen-bot
8月21日 评论:
8月21日 评论:
atomgit-bot
8月21日 评论:
8月21日 评论:
8月21日 添加了label:openJiuwen-cla/yes
openJiuwen-bot
8月21日 评论:
8月21日 评论:
openJiuwen-bot
8月21日 评论:
8月21日 评论:
The pipeline(pipeline number:8) is running. Please wait a moment...


8月21日 添加了label:ci-running
8月21日 删除了label:ci-running
8月21日 添加了label:ci-successful
songlicheng
8月22日 评论:
8月22日 评论:
/lgtm
/approve


openJiuwen-bot
8月22日 评论:
8月22日 评论:
8月22日 合入了pull request,合并节点 SHA:a2b62c2c1de1609c130bdcd58fda76ab1b8974ef
8月22日 删除了label:ci-successful
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