Paul Gadal
12/15/2025, 10:19 AM.prefect/storage/d7850ddbc32d4d5a809244d0239dc7e4 is it safe to delete them after few days ? what are they for and is there a possibility to not store it ?Marvin
12/15/2025, 10:19 AMMarvin
12/15/2025, 10:30 AM~/.prefect/storage/ are persisted results and/or cached task results.
- Yes, it’s safe to delete them when you don’t need to reuse results/caches and no flows are currently running. Deleting them will force recomputation on future runs.
- You can avoid storing them by disabling result persistence and/or caching globally or per-flow/task.
Details:
What they are
- Prefect 3.x writes task/flow results (and cache data) to a local result store by default at ~/.prefect/storage/ unless you’ve configured a different result storage block.
- The filenames are storage keys (UUID-/hash-like strings) and hold serialized results and metadata.
- They are not your source code or deployments—just result artifacts.
- Docs: Results, Caching, Settings
Is it safe to delete?
- Yes, with caveats:
- Do not delete while flows are running.
- If you rely on cached results across runs, you’ll lose those caches and tasks will recompute.
- If you plan to load persisted results from prior runs (e.g., inspecting state results later), deletion will make them unavailable.
How to stop storing results
- Globally (recommended if you don’t want local result files at all):
- Keep global persistence off (it’s off by default), and disable caching.
- You can enforce via Prefect config:
prefect config set PREFECT_RESULTS_PERSIST_BY_DEFAULT=false
prefect config set PREFECT_TASKS_DISABLE_CACHING=true
- Optionally move the directory to an ephemeral path if you still want caching but don’t want long-lived files:
prefect config set PREFECT_RESULTS_LOCAL_STORAGE_PATH=/tmp/prefect-results
- Per-task/flow:
- Turn off persistence and caching explicitly and/or send results to a Null sink:
from prefect import flow, task
from prefect.cache_policies import NO_CACHE
from prefect.filesystems import NullFileSystem
@task(persist_result=False, cache_policy=NO_CACHE, result_storage=NullFileSystem())
def compute():
return "no files written"
@flow(persist_result=False, result_storage=NullFileSystem())
def my_flow():
return compute()
- If you just want to disable caching but allow in-memory results during a run:
@task(cache_policy=NO_CACHE)
def compute():
...
Cleaning up existing files
- Safe when nothing is running:
rm -rf ~/.prefect/storage/*
- Or move them:
mv ~/.prefect/storage ~/.prefect/storage.backup
If you want, tell me whether you’d like to disable storage globally for all runs or just certain flows/tasks, and if you need caching at all—I can tailor the exact config or code changes.