KernelDB.prune_metakernels()
Find registry rows whose remote URL is permanently gone and optionally remove them.
Usage
KernelDB.prune_metakernels(
dry_run=True,
delete_files=False,
timeout=10.0,
)A HEAD request is sent to each row’s URL, and a permanent HTTP error (403, 404 or 410) marks the row as dead. This typically happens when NAIF rotates old versioned snapshots into former_versions/.
The probe URL is derived per row: the explicit source_url if set, otherwise mission.mk_dir_url + filename (the same fallback as update_metakernel). Rows with neither, typically locally created metakernels with no upstream, are noted in the output and skipped. Use skd rm <name> to drop them manually.
Transient failures (timeouts, DNS errors, 5xx) are deliberately never classified as dead. Leaving a registry row stale is always safer than deleting it on a network blip.
Parameters
dry_run: bool = True-
With
True(the default) only report what would be removed. WithFalsethe matching rows are removed frommetakernel_registryandmetakernel_entries. delete_files: bool = False-
With
dry_run=False, also unlink the on-disk.tmfile. Symlink trees under the mission’s download directory are shared across metakernels and are never cleaned automatically. timeout: float = 10.0- Timeout of each HEAD request, in seconds.
Returns
list[dict]-
One dict per dead metakernel with the keys
mk_path,filename,mission,source_urlandstatus_code.