-
Notifications
You must be signed in to change notification settings - Fork 750
Add support cache for dynamic spec #6372
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Code Review Agent Run Status
|
Signed-off-by: Alex Wu <[email protected]>
Code Review Agent Run Status
|
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Code Review Agent Run Status
|
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Code Review Agent Run Status
|
This an interesting change @popojk. I have been working in this area lately and I'm trying to fully understand where this provides values. When you say OOM happens during sub node execution are you referring to OOM in Propeller or OOM in the task? I think during normal operation compiling the workflow only happens once so I'm skeptical if the change here is worth it. |
Hi @Sovietaced . This PR is aiming to add a cache for future.pb that compiled by dynamic workflow. As far as I know, when a task in dynamic workflow OOM during execution, propeller will re-compile future.pb while re-executing the same dynamic workflow, leading to duplicated computation. Please let me know if you have any other suggestions. 😎 |
Tracking issue
Closes #5543
Why are the changes needed?
When executing a dynamic workflow in the Flyte backend, compiling the future.pb file before sub-node execution takes some time. If an out-of-memory (OOM) error occurs during sub-node execution, re-running the dynamic workflow requires recompiling the future.pb file, consuming additional time and computational resources. To address this, we propose caching the compiled future.pb file.
The future cache mechanism in this PR stores the compiled file as artifact data in Flyte storage via the datacatalog. The cache key, TagName, is determined by the hash of the input values. The diagrams below illustrate the data flow in the backend system:

What changes were proposed in this pull request?
Please refer to bellow diagram for understanding the procedure of how future read/write:

key changes:
1.Added Mode to TaskTemplate Metadata in flyteidl to indicate whether a task is a DynamicTask.
2.Implemented logic in flytepropeller to send cache read/write requests to datacatalog.
3.Added cache read/write functionality to the storage layer in datacatalog.
How was this patch tested?
To test how much time it saved when future file cache hit, we modify this block of code to count the time spend to run taskNodeHandler.Handle for test purpose.
To mimic OOM, we will throw panic in dynamicNodeHandler. So the Dynamic workflow will be aborted after future file compiled
then we run bellow test dynamic workflow for the first time
We use the command
pyflyte run --remote dynamic.py wf --s1="dynamic" --s2="test"
The first run took around 17 ms to compile future file
Then we remove the panic throwing and re-execute the same workflow with the same input. The future cache hit and it only took 83ns to go through the taskNodeHandler.Handle code block, which means the taskNodeHandler.Handle is skipped.
Moreover, unit tests has been added to make sure cache behaviors.
Labels
Please add one or more of the following labels to categorize your PR:
This is important to improve the readability of release notes.
Check all the applicable boxes
Related PRs
flytekit PR