Skip to content

Conversation

@BarryWu0812
Copy link
Contributor

@BarryWu0812 BarryWu0812 commented Aug 2, 2025

Tracking issue

Closes flyteorg/flyte#6032

Why are the changes needed?

We should only serialize the variable and upload it once to reuse the same input.

To make the same Python value reuse the literal.

What changes were proposed in this pull request?

Add a local cache to store the literal that has been serialized.

How was this patch tested?

Unit test

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Summary by Bito

This pull request enhances the Flyte framework by implementing a local caching mechanism using an LRU cache for serialized literals, replacing the previous cache. This improvement boosts efficiency by reducing redundant serialization and uploads of identical Python values. A new unit test has been added to verify caching behavior when pandas is unavailable, and existing unit tests have been updated to ensure the new caching behavior is validated.

@codecov
Copy link

codecov bot commented Aug 5, 2025

Codecov Report

❌ Patch coverage is 23.52941% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.97%. Comparing base (eb5a67f) to head (9597122).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
flytekit/core/type_engine.py 23.52% 13 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (eb5a67f) and HEAD (9597122). Click for more details.

HEAD has 75 uploads less than BASE
Flag BASE (eb5a67f) HEAD (9597122)
100 25
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3307       +/-   ##
===========================================
- Coverage   85.26%   44.97%   -40.29%     
===========================================
  Files         386      319       -67     
  Lines       30276    26812     -3464     
  Branches     2969     2953       -16     
===========================================
- Hits        25814    12060    -13754     
- Misses       3615    14655    +11040     
+ Partials      847       97      -750     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Barry Wu <[email protected]>
Copy link
Member

@machichima machichima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Thank you!

Just some nit

Signed-off-by: Barry Wu <[email protected]>
@BarryWu0812 BarryWu0812 requested a review from machichima August 15, 2025 06:42
@BarryWu0812 BarryWu0812 requested a review from machichima August 22, 2025 07:15
Signed-off-by: Barry Wu <[email protected]>
@BarryWu0812 BarryWu0812 requested a review from pingsutw August 27, 2025 16:03
@pingsutw pingsutw merged commit 9effe91 into flyteorg:master Sep 19, 2025
112 of 115 checks passed
Atharva1723 pushed a commit to Atharva1723/flytekit that referenced this pull request Oct 5, 2025
Signed-off-by: Barry Wu <[email protected]>
Co-authored-by: Kevin Su <[email protected]>
Co-authored-by: Nary Yeh <[email protected]>
Signed-off-by: Atharva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core feature] Reuse same literals in the dynamic task

4 participants