Load a Package
This page explains how to use the kxi pm load
command to load a package in kdb Insights Enterprise using the command line interface (CLI).
Overview
The kxi pm load
command allows you to load a package into running Data Access Processes (DAPs) and aggregators without requiring a redeployment. This applies for both a deployed package and the global aggregators, and is especially useful when developing User-Defined Analytics (UDAs).
Usage
The kxi pm load
command loads a package into a running deployment or global process.
Run the --help
command as follows to learn about the options you can use with the kxi pm load
command:
bash
kxi pm load --help
console
Usage: kxi pm load [OPTIONS] PACKAGE
Load a package into running deployment or global processes
╭─ Authentication option overrides ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --hostname,--url TEXT Insights URL │
│ --realm TEXT Realm │
│ --client-id TEXT Client id │
│ --client-secret TEXT Client secret │
│ --auth-enabled/--auth-disabled Retrieve Bearer Token │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --deployment -d NAME_GLOB_OR_UUID │
│ --targets -t TEXT Comma-separated targets: daps,qe_daps,pkg_agg,pkg_qe_agg │
│ --global-processes -g TEXT Comma-separated global processes: agg,qe_agg │
│ --version TEXT Version of the package to load. │
│ --server-timeout INTEGER Timeout for Insights server calls │
│ --yes,--assume-yes -y Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. │
│ --output-format -o [json|table] Output format for the command. default: 'table'. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Examples
This section provides a couple of usage examples for the kxi pm load
command.
-
Load a UDA package (
uda-pkg
) into the QE DAPs of a deployed package calledmypackage
. For example:bash
Copykxi pm load uda-pkg -d mypackage -t qe_daps
╭────────────┬─────────────────────────────────┬─────────────────────────────────────────────────────────────────────────╮
│ deployment │ packages │ statuses │
├────────────┼─────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ mypackage │ ╭─────────┬─────────┬─────────╮ │ ╭─────────────────────────────┬─────────┬─────────────────────────────╮ │
│ │ │ name │ version │ targets │ │ │ name │ status │ details │ │
│ │ ├─────────┼─────────┼─────────┤ │ ├─────────────────────────────┼─────────┼─────────────────────────────┤ │
│ │ │ uda-pkg │ 0.0.1 │ qe_daps │ │ │ mypackage-qe-dap-da-0 (hdb) │ SUCCESS │ Package loaded successfully │ │
│ │ ╰─────────┴─────────┴─────────╯ │ │ mypackage-qe-dap-da-0 (idb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ │ mypackage-qe-dap-da-0 (rdb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ ╰─────────────────────────────┴─────────┴─────────────────────────────╯ │
╰────────────┴─────────────────────────────────┴─────────────────────────────────────────────────────────────────────────╯ -
Load a package onto a deployed package and a global aggregator at the same time. For example:
bash
Copykxi pm load uda-pkg -d mypackage -g agg
╭────────────┬────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────╮
│ deployment │ packages │ statuses │
├────────────┼────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┤
│ mypackage │ ╭─────────┬─────────┬────────────────────────────────────╮ │ ╭─────────────────────────────┬─────────┬─────────────────────────────╮ │
│ │ │ name │ version │ targets │ │ │ name │ status │ details │ │
│ │ ├─────────┼─────────┼────────────────────────────────────┤ │ ├─────────────────────────────┼─────────┼─────────────────────────────┤ │
│ │ │ uda-pkg │ 0.0.1 │ daps, qe_daps, pkg_agg, pkg_qe_agg │ │ │ mypackage-dap-da-0 (hdb) │ SUCCESS │ Package loaded successfully │ │
│ │ ╰─────────┴─────────┴────────────────────────────────────╯ │ │ mypackage-dap-da-0 (idb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ │ mypackage-dap-da-0 (rdb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ │ mypackage-qe-dap-da-0 (hdb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ │ mypackage-qe-dap-da-0 (idb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ │ mypackage-qe-dap-da-0 (rdb) │ SUCCESS │ Package loaded successfully │ │
│ │ │ ╰─────────────────────────────┴─────────┴─────────────────────────────╯ │
│ __GLOBAL__ │ ╭─────────┬─────────╮ │ ╭────────────────────────────────────────┬─────────┬─────────────────────────────╮ │
│ │ │ name │ version │ │ │ name │ status │ details │ │
│ │ ├─────────┼─────────┤ │ ├────────────────────────────────────────┼─────────┼─────────────────────────────┤ │
│ │ │ uda-pkg │ 0.0.1 │ │ │ nightly-pakx-aggregator-0 (aggregator) │ SUCCESS │ Package loaded successfully │ │
│ │ ╰─────────┴─────────╯ │ ╰────────────────────────────────────────┴─────────┴─────────────────────────────╯ │
╰────────────┴────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────╯
Note
If --targets
is omitted, the command defaults to all applicable targets.
Configuration requirements
To enable dynamic package loading, the following environment variables must be set:
-
ALLOW_PACKAGE_LOAD
-
ALLOW_PACKAGE_LOAD_GLOBAL_PROCESSES
These can be set at install time in the values
yaml, as follows:
YAML
kxi-package-manager:
env:
ALLOW_PACKAGE_LOAD: true
ALLOW_PACKAGE_LOAD_GLOBAL_PROCESSES: true
Alternatively, you can set them using the kxi pm config set
command, as follows:
bash
kxi pm config set ALLOW_PACKAGE_LOAD true
kxi pm config set ALLOW_PACKAGE_LOAD_GLOBAL_PROCESSES true
Important
Running this command requires that you have the insights.admin.package.system
role.
To use kxi pm load
, you must have the Execute (X) entitlement on the package being loaded. The UDA package needs to exist on the package manager server before it can be loaded into your package. For example:
bash
kxi pm push uda-pkg
kxi pm load uda-pkg -d mypackage -t qe_daps
Your package must be deployed before you can run the kxi pm load
command, otherwise it errors out.
Considerations
When running the kxi pm load
command, consider the following:
-
Reload failures: If the new code contains errors (for example, syntax issues), the reload fails. This may result in the removal of previously working UDAs.
-
Pod restarts: Dynamically loaded code is not persisted across pod restarts unless explicitly loaded through
init.q
or similar startup scripts.
Next steps
-
Learn how to tear down a package