<#3211 support using cache policies in with_overri...
# flyte-github
c
#3211 support using cache policies in with_overrides Pull request opened by pvditt ## Tracking issue fixes: https://linear.app/unionai/issue/BB-4976/cache-policies-dont-work-w-caching-subworkflows Follow up changes: • https://linear.app/unionai/issue/BB-4977/with-overrides-cache-doesnt-support-ignore-input-vars (need idl change) • https://linear.app/unionai/issue/BB-4978/add-support-for-not-setting-cache-version-in-with-overrides ## Why are the changes needed? with_overrides doesn't work when setting Cache object ## What changes were proposed in this pull request? support setting Cache object in with_overrides + maintain backwards compatibility w/ existing params ## How was this patch tested? • added unit test https://dogfood.cloud-staging.union.ai/console/projects/flytesnacks/domains/development/executions/acmrgrn887lb2kzn59dk/nodes https://dogfood.cloud-staging.union.ai/console/projects/flytesnacks/domains/development/executions/avwrqd2cq7796skz6xqc https://dogfood.cloud-staging.union.ai/console/projects/flytesnacks/domains/development/executions/advd5c2952qkmzj59hfh
Copy code
import 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/flytekit