如何拆分Python链?

发布于 2025-01-09 09:13:04 字数 417 浏览 2 评论 0原文

有人使用 python-chain 包并且知道是否可以拆分链?我想像

intermediate_result = chain.state() >> step_1 >> step_2

final_result_1 = intermediate_result >> step_3_1 >> step_4_1
final_result_2 = intermediate_result >> step_3_2 >> step_4_2

这里是我的意思的包的链接: https://pypi.org/project /python-链/

Does someone use the python-chain package and know if it is possible to split up chains? I would Imagine something like

intermediate_result = chain.state() >> step_1 >> step_2

final_result_1 = intermediate_result >> step_3_1 >> step_4_1
final_result_2 = intermediate_result >> step_3_2 >> step_4_2

Here the link to the package I mean: https://pypi.org/project/python-chain/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嗫嚅 2025-01-16 09:13:04

找到 anwser:

intermediate_result = chain.state() >> step_1 >> step_2

final_result_1 = intermediate_result.current >> step_3_1 >> step_4_1
final_result_2 = intermediate_result.current >> step_3_2 >> step_4_2

请注意,只有在 middle_result 不包含任何不可序列化对象(例如 pyspark 数据帧)时,这才有效

Found the anwser:

intermediate_result = chain.state() >> step_1 >> step_2

final_result_1 = intermediate_result.current >> step_3_1 >> step_4_1
final_result_2 = intermediate_result.current >> step_3_2 >> step_4_2

Be aware that this only work if intermediate_result does not contain any non-serializable object such as pyspark dataframes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文