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

cache ignore portion #2275

Merged
merged 3 commits into from
Mar 18, 2024
Merged

cache ignore portion #2275

merged 3 commits into from
Mar 18, 2024

Conversation

troychiu
Copy link
Member

@troychiu troychiu commented Mar 18, 2024

Tracking issue

Users can specify input vars that will not be included when calculating cache

Why are the changes needed?

See flyteorg/flyte#3058

What changes were proposed in this pull request?

Add "cache_ignore_input_vars" to task's metadata
Check if an input var is in the cache_ignore_input_vars while calculating the hash for cache, skip the input var if yes.

How was this patch tested?

from flytekit import task, workflow


@task(cache=True, cache_version="v1", cache_ignore_input_vars=["a"])
def add(a: int, b: int) -> int:
    return a + b

@workflow
def add_wf(a: int, b: int) -> int:
    return add(a=a, b=b)

if __name__ == "__main__":
    assert add_wf(a=10, b=5) == 15
    assert add_wf(a=20, b=5) == 15  # since a is ignored, this line will hit cache of a=10, b=5
    assert add_wf(a=20, b=8) == 28

Related PRs

flyteorg/flyte#4618

Signed-off-by: troychiu <[email protected]>
pingsutw
pingsutw previously approved these changes Mar 18, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by maintainer label Mar 18, 2024
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.32%. Comparing base (96f2b2a) to head (cecb492).
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2275      +/-   ##
==========================================
- Coverage   83.99%   83.32%   -0.68%     
==========================================
  Files         319      309      -10     
  Lines       24326    24059     -267     
  Branches     3693     3494     -199     
==========================================
- Hits        20433    20047     -386     
- Misses       3272     3385     +113     
- Partials      621      627       +6     

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

Signed-off-by: troychiu <[email protected]>
Signed-off-by: troychiu <[email protected]>
@troychiu troychiu marked this pull request as ready for review March 18, 2024 17:10
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 18, 2024
@troychiu troychiu requested a review from pingsutw March 18, 2024 17:11
@pingsutw pingsutw merged commit c8ac276 into master Mar 18, 2024
46 of 47 checks passed
fiedlerNr9 pushed a commit that referenced this pull request Jul 25, 2024
Signed-off-by: troychiu <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants