Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional async flow within a async function -> RuntimeError: cannot reuse already awaited coroutine #252

Closed
amoallim15 opened this issue Aug 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@amoallim15
Copy link

amoallim15 commented Aug 7, 2024

Description

Running the example below throws this error. Please advise.

File "/Users/*****/Library/Application Support/hatch/env/virtual/agent/D2qYGUjn/agent/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 231, in coroutine_wrapper
    return await task
           ^^^^^^^^^^
RuntimeError: cannot reuse already awaited coroutine

Example Code

import asyncio
from controlflow import flow


@flow
async def main_flow():
    return await cf.run_async(
        "Say hello.",
        result_type=str,
    )

async def runner():
    result = await main_flow()

asyncio.run(runner())

Version Information

controlflow version = 0.8.2

Additional Context

No response

@amoallim15 amoallim15 added the bug Something isn't working label Aug 7, 2024
@jlowin
Copy link
Member

jlowin commented Sep 26, 2024

I apologize for missing this somehow -- fix PR'd and will go out shortly.

@jlowin jlowin closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants