## KernelDB.get_metakernel()


Fetch a remote metakernel, show its status, and download the missing kernels.


Usage

``` python
KernelDB.get_metakernel(
    url,
    download_dir=None,
    mission=None,
    yes=False,
    force=False,
    alias_filename=None,
    verbose=False,
    dry_run=False
)
```


The steps are:

1.  Fetch and parse the remote `.tm` file.
2.  Resolve each kernel entry to a full URL, using `PATH_VALUES` relative to the metakernel URL.
3.  Check each kernel against the local database.
4.  Query the remote file sizes with parallel HTTP HEAD requests.
5.  Show a summary table with kernel names, sizes and status (`in db` or `missing`) on the instance's console.
6.  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 like `dry_run`, writes nothing, and the result carries `aborted: True`.
7.  Download the missing kernels, preserving the subdirectory structure, and register them.
8.  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 `.tm` metakernel file.

`download_dir: str | Path | None = None`  
The kernel root to download into. `None` means `root_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.tm` when the actual file is `juice_crema_5_2_v470_20260415_001.tm`. A symlink is created at `mk/<alias_filename>` pointing to the downloaded file, and a second `metakernel_registry` row is added so `which <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 update` runs without `--execute` (#47).


## Returns


`dict`  
With the keys `found` and `missing` (the indices of the metakernel's kernel entries that are in the database and that are not), `downloaded` (the paths of the registered files) and `warnings`. After a dry run the dict also has `dry_run: True` and `downloaded` is empty. It has `aborted: True` when 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_dir` is not given and [root_for](KernelDB.root_for.md#spice_kernel_db.KernelDB.root_for) cannot choose among several roots. Pass `download_dir` then.

`ConcurrentModificationError`  
Another process modified the kernel records while the lock was released for the network I/O.

`ValueError`  
A `PATH_VALUES` entry of the remote metakernel resolves outside the download directory.
