KernelDB.get_metakernel()
Fetch a remote metakernel, show its status, and download the missing kernels.
Usage
KernelDB.get_metakernel(
url,
download_dir=None,
mission=None,
yes=False,
force=False,
alias_filename=None,
verbose=False,
dry_run=False
)The steps are:
- Fetch and parse the remote
.tmfile. - Resolve each kernel entry to a full URL, using
PATH_VALUESrelative to the metakernel URL. - Check each kernel against the local database.
- Query the remote file sizes with parallel HTTP HEAD requests.
- Show a summary table with kernel names, sizes and status (
in dbormissing) on the instance’s console. - Ask for confirmation on that console, unless
yes=True. With no console there is nobody to ask. The call then stops after the status step likedry_run, writes nothing, and the result carriesaborted: True. - Download the missing kernels, preserving the subdirectory structure, and register them.
- Create symlinks for the kernels already in the database, so the metakernel works immediately. This applies when deduplication is enabled for the mission. Without it every kernel is downloaded fresh.
The metakernel itself is saved as <download_dir>/<mission>/mk/<filename> with absolute PATH_VALUES, so it works from any working directory. Downloaded files are placed under <download_dir>/<mission>/<relpath>.
The table is shown whenever there is a console. It precedes the download question, so it is what you decide on.
Parameters
url: str-
URL of a remote
.tmmetakernel file. download_dir: str | Path | None = None-
The kernel root to download into.
Nonemeansroot_for(mission): the configured root that already holds kernels of the mission, or the only configured root. A URL that is already tracked uses that row’s root. mission: str | None = None-
Override the mission name, which is otherwise guessed from the URL.
yes: bool = False-
Skip the confirmation prompt.
force: bool = False-
Treat all kernels as missing and download them again.
alias_filename: str | None = None-
A second name to expose this metakernel under, for example the version-stripped
juice_crema_5_2.tmwhen the actual file isjuice_crema_5_2_v470_20260415_001.tm. A symlink is created atmk/<alias_filename>pointing to the downloaded file, and a secondmetakernel_registryrow is added sowhich <alias_filename>works. When the server redirects to a differently named file, the requested name is used as the alias automatically. verbose: bool = False-
List each kernel’s resolved URL beneath the status table.
dry_run: bool = False-
Stop after the status table. Nothing is written to disk or to the database and no kernel is downloaded. This is what
skd updateruns without--execute(#47).
Returns
dict-
With the keys
foundandmissing(the indices of the metakernel’s kernel entries that are in the database and that are not),downloaded(the paths of the registered files) andwarnings. After a dry run the dict also hasdry_run: Trueanddownloadedis empty. It hasaborted: Truewhen nothing was downloaded because there was no console to ask on, or because the question was answered no. In the second case the registry is restored to its state before the call.
Raises
AmbiguousKernelRoot-
download_diris not given and root_for cannot choose among several roots. Passdownload_dirthen. ConcurrentModificationError-
Another process modified the kernel records while the lock was released for the network I/O.
ValueError-
A
PATH_VALUESentry of the remote metakernel resolves outside the download directory.