Eager mode: enable awaitable execution graphs in Flyte #3396
Closed
cosmicBboy
started this conversation in
RFC Incubator
Replies: 2 comments
-
25/05/2023 Contributors' sync: First experimental version will not prune "external child executions" launched by |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closing this as feature is already implemented. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Currently, Flyte offers two constructs for composing
task
s into more complex execution graphs: static workflows (via the@workflow
decorator) and dynamic workflows (via the@dynamic
decorator). As the names suggest, static workflows are created at compile time and registered to some target Flyte cluster. On the other hand, dynamic workflows are compiled at runtime so that they can materialize the inputs of the workflow and use them to influence the shape of the execution graph.Problem Statement
Both static and dynamic workflows pose a problem. While they provide type safety (moreso for static, although type errors will occur when dynamic workflows are created at runtime), they both suffer from inflexibility in expressing execution graphs that many Python
flytekit
users may be accustomed to. This is because in actuality,@workflow
and@dynamic
function code is not Python code: it's a DSL for constructing execution graphs that suffer from the "uncanny valley" of looking like Python code, but isn't actually Python code. For example:if... elif... else
statements not supported and the equivalent syntax is cumbersome to write withconditionals
.try... except
statements are not supported.async
code is not supported.For Python users who come in with expectations of writing Python to compose their workflows, Flyte is surprising both in terms of (a) the lack of useful error messages when trying illegal combinations of Flyte and Python syntax and (b) the inability to compose tasks using the
asyncio
syntax. The scope of this RFC is to focus on the latter.Proposal
This RFC proposes adding support for "eager workflows" indicated by the
@eager
decorator in a new subpackageflytekit.experimental
, which will contain experimental features. This construct allows users to write workflows pretty much like how one would write asynchronous Python code. For example:Trade-offs
At a high-level, we can think of these three ways of writing workflows in terms of Flyte promises, and what data are accessible to the user in the workflow code:
@workflow
@dynamic
@workflow
, can do Python operations on inputs@eager
Open Questions
FlyteRemote
configuration?MVP
flytepropeller
and hard-coded secret group/key:Beta Was this translation helpful? Give feedback.
All reactions