cuddly-jelly-27016
03/31/2025, 4:38 AMimport union
@union.task
def sum(a: int, b: int, c: int) -> int:
return a + b + c
@union.workflow
def child_wf(a: int=1, b: int=2, c: int=3) -> list[int]:
return [
sum(a=a, b=b, c=c).with_overrides(cache=union.Cache(version="1.0", serialize=True, ignored_inputs=["a"]))
for _ in range(5)
]
child_lp = union.LaunchPlan.get_or_create(child_wf)
@union.workflow
def parent_wf_with_subwf(input: int = 0):
return [
# Enable caching on the subworkflow
child_wf(a=input, b=3, c=4).with_overrides(cache=union.Cache(version="1.0", serialize=True, ignored_inputs=["a"]))
for i in [1, 2, 3]
]
@union.workflow
def parent_wf_with_sublp(input: int = 0):
return [
child_lp(a=input, b=1, c=2).with_overrides(cache=union.Cache(version="1.0", serialize=True, ignored_inputs=["a"]))
for i in [1, 2, 3]
]
### Setup process
### Screenshots
## Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
## Related PRs
## Docs link
### Summary by Bito
This PR enhances caching functionality by supporting Cache objects in with_overrides method across core modules. It refines Node, Promise, and Task classes to handle boolean or Cache objects while phasing out deprecated parameters. The changes include improved error handling and backward compatibility logic.
Unit tests added: True
Estimated effort to review (1-5, lower is better): 2
flyteorg/flytekitcuddly-jelly-27016
03/31/2025, 4:38 AMcuddly-jelly-27016
04/01/2025, 1:15 AM