Skip to main content

KernelDB.update_metakernel()

Re-fetch a metakernel from its source URL and download new or missing kernels.

Usage

Source

KernelDB.update_metakernel(
    mk_path_or_name,
    mission=None,
    download_dir=None,
    yes=False,
    force=False,
    verbose=False,
    dry_run=False,
    rescan=True
)

The source URL comes from the metakernel_registry. If no source URL is stored, the mission’s mk_dir_url plus the filename is used. After downloading, the kernel directories referenced by the metakernel are rescanned, so newly downloaded files are indexed at once. The rescan does not happen after a dry run or with force, since get_metakernel has already registered everything then.

Parameters

mk_path_or_name: str | Path

The mk_path or filename of a registered metakernel, or any other form resolve_metakernel takes.

mission: str | None = None

Override the mission name, which is otherwise read from the registry row.

download_dir: str | Path | None = None

Override the kernel root. By default it is the one that holds the metakernel (root_for).

yes: bool = False

Skip the confirmation prompt.

force: bool = False

Download everything again.

verbose: bool = False

Name each directory as it is rescanned. Otherwise the count is reported in one line (#4).

dry_run: bool = False

Report what would change and write nothing (#47). No rescan happens.

rescan: bool = True
Re-index the directories the metakernel points at after the download. update_all passes False and scans each distinct directory once at the end.

Returns

dict
The dict get_metakernel returns. After a real run (neither dry_run nor force) it also has scan_dirs, the set of directories the metakernel points at.

Raises

MetakernelNotTracked

The metakernel is not in the registry.

AmbiguousMetakernel

The reference matches several registry rows.

LookupError

The metakernel was added by scan or import without a source URL, and its mission has no mk/ URL.

MetakernelUnreachableError

The remote returns HTTP 403, 404 or 410. This is typically NAIF rotating the file into former_versions/. Use prune_metakernels to clean up the stale registry row.

AmbiguousKernelRoot
download_dir is not given and root_for cannot choose.