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

[flytekit] Add support for async workflows #6051

Open
2 tasks done
wild-endeavor opened this issue Nov 27, 2024 · 2 comments
Open
2 tasks done

[flytekit] Add support for async workflows #6051

wild-endeavor opened this issue Nov 27, 2024 · 2 comments
Assignees
Labels
backlogged For internal use. Reserved for contributor team workflow. enhancement New feature or request Epic: Async Flytekit Enable asynchronous behavior in flytekit

Comments

@wild-endeavor
Copy link
Contributor

wild-endeavor commented Nov 27, 2024

Background

The new version of the eager task attempts to be more pythonic in its handling of async function definitions. This means however that eager tasks, which are async functions, cannot be called within a normal workflow (@workflow). This is an okay limitation for the first draft of the new eager functionality, but we should fix it.

Goal

Not sure what the goal should look like, except that eager tasks should be callable within workflows. More thought should be given on how to do this.

Maybe we have async workflow functions

@workflow
async def wf() -> T:
    c1 = eager_1()
    n1 = await c1
    so1 = simple_task_1(a=n1)

    c2 = eager_2(a=so1)
    n2 = await asyncio.create_task(c2)
    simple_task_2(a=n2)

    # this needs to error
    # if n2 > 15:
    #     r4 = await eager_4()

    c3 = eager_3(a=so1, b=n2)
    n3, = asyncio.gather(c3)

    return n3

Or maybe we keep workflows static, something like

@workflow
def wf() -> T:
    n1 = asyncio.run(eager_1())
    so1 = simple_task_1(a=n1)

    return so1

In the latter case, how does using asyncio.run (which users will inevitably use) interfere with the loop manager in asyn.py?

cc @cosmicBboy @thomasjpfan @eapolinario

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@wild-endeavor wild-endeavor added enhancement New feature or request untriaged This issues has not yet been looked at by the Maintainers labels Nov 27, 2024
@wild-endeavor wild-endeavor changed the title [Core feature] ddd [flytekit] Add support for async workflows Nov 27, 2024
@mattiadevivo
Copy link

following this, I need to call an async function in my worflow and I'd be interested in understanding how to do it

@wild-endeavor wild-endeavor added the backlogged For internal use. Reserved for contributor team workflow. label Dec 2, 2024
@wild-endeavor
Copy link
Contributor Author

@mattiadevivo until this issue is fixed, you won't be able to. Will wait to see what form the solution here takes but it will need to be awaited.

@eapolinario eapolinario added Epic: Async Flytekit Enable asynchronous behavior in flytekit and removed untriaged This issues has not yet been looked at by the Maintainers labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlogged For internal use. Reserved for contributor team workflow. enhancement New feature or request Epic: Async Flytekit Enable asynchronous behavior in flytekit
Projects
Status: Backlog
Development

No branches or pull requests

4 participants