Add task-level cache max age support - #1501
Merged
Merged
Conversation
wild-endeavor
left a comment
Contributor
There was a problem hiding this comment.
don't we need to bump something in pyproject? or did someone else already do that? what's the min idl version needed for this?
Contributor
|
oh you were waiting on a new version - looks like someone published https://pypi.org/project/flyteidl2/2.0.45/ |
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
pvditt
force-pushed
the
pvditt/max-cache-age
branch
from
September 1, 2026 19:27
2067aa2 to
05822e4
Compare
wild-endeavor
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cache.max_ageas a task-level cache policy, accepting a nonnegativetimedeltaor integer number of secondsTaskMetadata.cache_max_age, preserving the distinction between unset and explicit zeroNoneuses the platform default, zero disables age-based expiration, and a positive value limits the age of cached results that the task will reuse.IDL dependency
This depends on
TaskMetadata.cache_max_agefrom flyteorg/flyte#7938 (commit). The dependency pin is intentionally not changed in this PR, so CI is expected to fail againstflyteidl2==2.0.44until a new IDL version is published and the SDK pin is bumped.Testing
Using a locally built
flyteidl2==2.0.45.dev0wheel:pytest -q tests/user_api/test_cache.py tests/flyte/internal/runtime/test_task_serde.py tests/flyte/remote/test_task.py tests/flyte/test_image.py— 177 passedgit diff --checkpassedDogfood validation
Validated against
dogfood/flytesnacks/developmentand the leaseworker implementation in unionai/cloud#18043. The expiring task template containedcacheMaxAge: 60s; the normal-cache task omitted the field.CACHE_MISS04:46:48.396163ZCACHE_HITCACHE_MISS04:49:31.529448ZCACHE_HITCACHE_MISS04:47:39.246597ZCACHE_HITCACHE_HITDogfood workers were still using an older SDK without the task-side constructor argument, so the probe used this SDK build for registration and an import-time compatibility guard for the older task runtime. Cache lookup and expiration occur in leaseworker before task execution.