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

add notes on TASK_SOURCE behavior #16928

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/v3/develop/task-caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Prefect comes prepackaged with a few common cache policies:
- `DEFAULT`: this cache policy uses the task's inputs, its code definition, as well as the prevailing flow run ID
to compute the task's cache key.
- `INPUTS`: this cache policy uses _only_ the task's inputs to compute the cache key.
- `TASK_SOURCE`: this cache policy uses _only_ the task's code definition to compute the cache key.
- `TASK_SOURCE`: this cache policy uses _only_ the task's code definition (and **not** source code of nested tasks) to compute the cache key.
- `FLOW_PARAMETERS`: this cache policy uses _only_ the parameter values provided to the parent flow run
to compute the cache key.
- `NO_CACHE`: this cache policy always returns `None` and therefore avoids caching and result persistence altogether.
Expand Down
2 changes: 2 additions & 0 deletions src/prefect/cache_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ def __add__(self, other: "CachePolicy") -> "CachePolicy":
class TaskSource(CachePolicy):
"""
Policy for computing a cache key based on the source code of the task.

This policy only considers raw lines of code in the task, and not the source code of nested tasks.
"""

def compute_key(
Expand Down
Loading