ModelEngine-Group / ModelEngine-Group/fit-framework

支持 fitable 函数写成 async def 异步函数

Open
#190 0 comments 0 reactions 1 assignee View on GitHub

@surpercodehang is already working on this.

Since Jul 3, 2025.

status: waiting-for-internal-feedback type: feature
Dominant language
Java
Stars
2.1k
Forks
335
PR merge metrics
No merged PRs in 30d

Description

功能摘要 / Feature Summary

支持 fitable 函数写成 async def 异步函数

功能类型 / Feature Type

全新功能 / New Feature

优先级 / Priority

中 - 有了更好 / Medium - Would be nice to have

问题描述 / Problem Description

需求来源:
目前在 fit framework 的 Python 版本中,我有一个需求,需要在被 @fitable 修饰的函数内部调用第三方异步函数(async API)。
现在问题是,无法直接将fitable函数写成 async def,调用时直接报错,也不能简单用 loop.run_until_complete 因为fit框架可能已经有事件循环在运行,导致冲突。有没有好的解决方案

建议的解决方案 / Proposed Solution

修改 fitable 装饰器,支持 @fitable 修饰 async def 函数

替代方案 / Alternative Solutions

在同步方法中直接添加异步调用

Image

确认事项 / Confirmations
  • 我已经搜索了现有的 issues 和讨论,确认这不是重复建议
    I have searched existing issues and discussions, confirming this is not a duplicate suggestion

  • 这个功能符合项目的目标和范围
    This feature aligns with the project's goals and scope

  • 我理解这个功能可能需要时间来实现
    I understand this feature may take time to implement

  • 我愿意协助实现这个功能 (可选)
    I'm willing to help implement this feature (optional)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.