PrefectHQ
prefect
BlogDocsChangelog

fix: exclude DEFAULT cache policy from triggering automatic persist_result

#19673Merged
Comparing
devin/OSS-6022-1765209223
(
80d1594
) with
main
(
51b566f
)
CodSpeed Performance Gauge
-1%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s
bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
-1%
460.1 µs466.7 µs

Ignored

bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+1%
33.7 ms33.2 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.5 ms107.7 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-5%
5.3 ms5.5 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+99%
11.5 ms5.8 ms
bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
163 ms163.4 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s

Commits

Click on a commit to change the comparison range
Base
main
51b566f
0%
fix: exclude DEFAULT cache policy from triggering automatic persist_result When with_options() is called on a task, it copies the DEFAULT cache policy to the new task instance. During initialization, the logic that automatically sets persist_result=True was incorrectly treating DEFAULT as an explicit user-configured cache policy, causing results to be persisted even when PREFECT_TASKS_DEFAULT_PERSIST_RESULT is set to False. This fix adds DEFAULT to the exclusion list alongside NO_CACHE and NotSet, ensuring that the auto-assigned DEFAULT policy doesn't trigger automatic result persistence. This preserves the global persist_result setting when using with_options(). Closes #16302 Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
b0ea015
2 days ago
by devin-ai-integration[bot]
-0.17%
test: add coverage for DEFAULT cache policy not triggering persist_result - Add test_default_cache_policy_does_not_set_persist_result_with_options - Update test_setting_cache_policy_sets_persist_result_to_true to exclude DEFAULT - Verifies fix for issue #16302 Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
3c72469
2 days ago
by devin-ai-integration[bot]
-0.06%
refactor: preserve user-provided persist_result and cache_policy in private variables Address PR feedback to use a cleaner approach that preserves the user's original persist_result and cache_policy values rather than modifying the cache_policy check logic. Changes: - Store user-provided persist_result in _user_persist_result before automatic logic - Store user-provided cache_policy in _user_cache_policy before automatic logic - Use _user_persist_result in with_options() instead of self.persist_result - Use _user_cache_policy in with_options() instead of self.cache_policy - Update MaterializingTask.with_options to map these parameters to private variables - Revert the previous change that added cache_policy != DEFAULT check This ensures with_options() passes the original user intent, allowing the new task to exercise the default persist_result logic and respect the global PREFECT_TASKS_DEFAULT_PERSIST_RESULT setting. Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
510c10a
1 day ago
by devin-ai-integration[bot]
-0.48%
test: address PR feedback - add MaterializingTask coverage and revert parametrized test - Add test for MaterializingTask.with_options() preserving user-provided values - Revert parametrized test to include DEFAULT in cache policies (per reviewer request) Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
80d1594
1 day ago
by devin-ai-integration[bot]
© 2025 CodSpeed Technology
Home Terms Privacy Docs