Skip to main content

store_discovery

Finds the SQLite stores the cache encryption sweep covers.

Each kind of store is looked for under its own known root, never by searching the cache directory as a whole, which also holds files the sweep must not touch (the trials mapping database and Prefect's database among them):

  • each pod's background_cache.db, under <cache_dir>/pods/<pod>/, and its backup snapshots;
  • every *.sqlite file under the dataset cache directory;
  • project databases: *.sqlite files directly in a project-database directory. A plaintext one counts only if it has a task_definitions table, so a user's own SQLite file in that directory is left alone;
  • each project's uploaded-MRN store, <task_results_dir>/<project>/_uploaded_mrns.

Roots are read from the settings when called, not when imported.

Module​

Functions​

find_stores​

def find_stores(    *, pod_names: Sequence[str] | None = None, project_db_dirs: Sequence[Path] = (),) ‑> list[Store]:

Lists every store the cache encryption sweep covers.

Arguments

  • pod_names: Only these pods' background caches; None for every pod's. Dataset caches, project databases and uploaded-MRN stores are listed either way.
  • project_db_dirs: The directories holding project databases.

Returns Each store once, whichever root reached it first, even if two roots overlap. A missing root contributes nothing.

Classes​

Store​

class Store(path: Path, store_type: StoreType):

One store the sweep covers.

Attributes

  • path: The SQLite file; for UPLOADED_MRNS, the store's directory.
  • store_type: What it is.

Variables​

StoreType​

class StoreType(*args, **kwds):

What a store is. Short codes, safe for telemetry and logs.

Variables​

  • static BACKGROUND_CACHE
  • static BACKGROUND_CACHE_BACKUP
  • static DATASET_CACHE
  • static PROJECT_DB
  • static UPLOADED_MRNS