-
Notifications
You must be signed in to change notification settings - Fork 297
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
wip Async/tasks #2927
Draft
wild-endeavor
wants to merge
19
commits into
master
Choose a base branch
from
async/tasks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
wip Async/tasks #2927
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2927 +/- ##
==========================================
+ Coverage 47.00% 51.28% +4.27%
==========================================
Files 199 201 +2
Lines 20840 21017 +177
Branches 2681 2698 +17
==========================================
+ Hits 9796 10778 +982
+ Misses 10558 9631 -927
- Partials 486 608 +122 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To support the growing interest to support Python async style programming, and to bring the
eager
mode out of experimental, this pr revamps the call patters in eager to support native Python async semantics. This PR also introduces the concept of async tasks. Note that while documentation refers to eager entities as "workflows", using the@eager
decorator produces a task, not a workflow, so they'll continue to show up under the Tasks tab of the Flyte UI.This is a backwards incompatible change for
@eager
.Usage Patterns
Below are some examples of how you might call the new eager workflow.
Simple Example
This is the simplest case. An eager workflow invokes a simple task. The container running the eager function will reach out to the control plane, and kick off a single-task execution.
This is akin to an async function in Python calling a synchronous function. It will automatically block until the results are available.
Controlling Execution
This example shows how you might do work at the same time as a task kicked off by eager is running. Again this follows the same semantics as Python. In Python the executing function also needs to relinquish control of the CPU by calling an await so that other items on the loop can progress.
Nested Example
Eager workflows can also be nested. If an eager workflow encounters another eager workflow, it will be launched against Admin as a single task execution, just like any other task.
Changes
High level changes
AsyncPythonFunctionTask
andEagerAsyncPythonFunctionTask
.flyte_entity_call_handler
to be async.as_python_native
to theLiteralsResolver
so it can produce proper un-packable outputs as the result of calling flyte entities.Remaining items
Remaining for this PR
The bar here is to include things that might break other parts of flytekit, or general tidiness for this PR. Eager may or may not be in a completely working state after these are in.
todo:async
and do or create follow-up issues for it.UX related
Cleanup
eager
into top level flytekitOther items
These probably make more sense to do after this is merged. Eager should be considered not completely usable until these are in.
Investigate
Things that came up in the course of this PR.
fut.result(None)
in code).How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link