Skip to content

optimize error stack of module#897

Merged
wzh1994 merged 5 commits intoLazyAGI:mainfrom
wzh1994:wzh/experience
Dec 18, 2025
Merged

optimize error stack of module#897
wzh1994 merged 5 commits intoLazyAGI:mainfrom
wzh1994:wzh/experience

Conversation

@wzh1994
Copy link
Contributor

@wzh1994 wzh1994 commented Dec 17, 2025

📌 PR 内容 / PR Description

  • 优化了Module的报错体验,包括基础的Module和ServerModule。把冗余的报错栈去掉,并且能清晰的指出哪一行出现了异常。

✅ 变更类型 / Type of Change

  • 修复 Bug / Bug fix (non-breaking change that fixes an issue)
  • 新功能 / New feature (non-breaking change that adds functionality)
  • 重构 / Refactor (no functionality change, code structure optimized)
  • 重大变更 / Breaking change (fix or feature that would cause existing functionality to change)
  • 文档更新 / Documentation update (changes to docs only)
  • 性能优化 / Performance optimization

🧪 如何测试 / How Has This Been Tested?

  1. 无需测试

⚡ 更新后的用法示例 / Usage After Update

import lazyllm
from lazyllm import ServerModule

def add1(x):
    return int(x) + 1

def add2(x, y):
    return int(x) + 1

with lazyllm.pipeline() as p:
    p.a = add1
    p.b = add1
    with lazyllm.pipeline().bind(y=1) as p.sub:
        p.sub.c = add2
        p.sub.d = add1
        with lazyllm.pipeline() as p3:
            p3.e = add1 | bind(y=2)
    p.c = add1
    
s3 = ServerModule(p)
s2 = ServerModule(s3)
s = ServerModule(s2)
s = lazyllm.ActionModule(s).start()

def test(x):
    return s(x)
    
def test2(x):
    return test(x)
    
with lazyllm.pipeline() as p_main:
    p_main.test = test2
    
if __name__ == "__main__":
    s(1)

优化后报错如下:

image

🔄 重构前 / 重构后对比 (仅当 Type 为 Refactor) / Refactor Before & After (only for Refactor)

重构前 / Before:

重构后 / After:

⚠️ 注意事项 / Additional Notes

@wzh1994 wzh1994 merged commit a7e4f92 into LazyAGI:main Dec 18, 2025
3 of 4 checks passed
@wzh1994 wzh1994 deleted the wzh/experience branch January 12, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant