NVIDIA/scadactl
Python
Captured source
source ↗NVIDIA/scadactl
Language: Python
License: Apache-2.0
Stars: 1
Forks: 0
Open issues: 0
Created: 2026-11-16T21:10:39Z
Pushed: 2026-11-16T21:51:02Z
Default branch: main
Fork: no
Archived: no
README:
SCADA Orchestrator (scadactl CLI)
The scadactl command is the user-facing control plane for configuring, launching, validating, and using SCADA on hosts with GPUs and NVMe storage. It keeps four concepts separate: inventory (what exists), config (what the operator wants, stable-identifier keyed), registry (what is running), and client selection (how an application connects).
The package imports and the hardware-free commands run on a machine with no GPU and no root. Hardware/driver/root-dependent paths are implemented against the real interfaces but lazy-imported and guarded so they degrade gracefully.
Layout
. pyproject.toml PEP 621 project; console_script `scadactl` README.md this file scripts/ manage-scada-domains launch and stop scada-swap-domain processes scadactl/ cli.py argparse dispatch + --help for every command models.py dataclasses: Inventory, Config, Registry (+ schema_version constants) inventory.py GPU (NVML) + drive (/sys, nvme, vfio-pci) enumeration identity.py alias gen, aliasid resolution, UUID->index, UNVMe correlation (sysfs primary + fallback) config.py YAML load/validate/author (all validation rules) plan.py desired-vs-registry diff + command rendering apply.py reconcile: validate->backend setup->MPS->launch->publish registry.py atomic locked read/write + reconcile semantics policy.py host device allow/block lists (inventory annotation) client.py container ordinal mapping; run/env/domains/check-client diagnostics.py status / doctor / logs backend/ binding.py wraps scada-load-/scada-unload-modules mps.py calls nvidia-cuda-mps-control directly launcher.py wraps manage-scada-domains (one call per domain) tests/ pytest; hardware-free, no GPU/root needed
Install
For a Python-only development or inspection environment, run from the repository checkout root:
python3 -m pip install -e . # installs the Python CLI and PyYAML python3 -m pip install -e '.[gpu]' # installs nvidia-ml-py (provides the pynvml module) for GPU-dependent commands python3 -m pip install -e '.[dev]' # also install build and pytest
pynvml is an optional, lazy import. Without it the package still imports and all hardware-free commands work; GPU-dependent commands fail with an actionable "install scadactl[gpu]" message.
The Python wheel installs the scadactl console command but not the privileged domain manager. A complete host installation uses the Debian package, which installs the CLI, Python modules, and manage-scada-domains:
dpkg-buildpackage -us -uc -b sudo apt install ../scadactl_0.6.0-1_all.deb
Storage drivers, backend capabilities, and scada-swap-domain are installed separately. See [DEPENDENCIES.md](DEPENDENCIES.md) for the complete runtime boundary and [packaging/README.md](packaging/README.md) for installed paths.
Commands
Configs are managed, name-addressable objects in a store at /etc/scada/configs (init/edit/import save there; list/show read it). Every config-consuming command takes either a bare store NAME or `-f FILE` (kubectl-style; mutually exclusive).
| Command | Purpose | | --- | --- | | scadactl inventory [--json] | Show GPUs, drives, aliases, topology, binding state | | scadactl config init [--empty\|--gpus\|--drives] [-o FILE] [--force] | Create a config (saves to the store) | | scadactl config list [--json] | List stored configs (name, domains, created/modified, active) | | scadactl config show NAME\|-f FILE [--json] | Show a config's details | | scadactl config edit NAME\|-f FILE | Interactively edit a config | | scadactl config rm NAME | Delete a stored config | | scadactl config import FILE [--force] | Register an external config file into the store | | scadactl config compat [-f FILE…] [--json] | Can these configs run concurrently? | | scadactl config validate NAME\|-f FILE [--json] | Validate (correctness/lint) | | scadactl config add-domain --name --gpu --drives [-f FILE] | Add a domain (aliases in, stable ids out) | | scadactl policy block\|unblock [--gpus …] [--drives …] [--reason …] | Mark devices off-limits / lift it (admin) | | scadactl policy allow\|unallow [--gpus …] [--drives …] | Confine SCADA to an allow-list / lift it (admin) | | scadactl policy list [--json] | Show the effective device policy per device | | scadactl policy clear [--all\|--block\|--allow] | Clear policy lists (admin) | | scadactl apply NAME\|-f FILE [--dry-run [--commands] [--json]] [--force] | Preview (--dry-run) or reconcile the host (--force overrides policy) | | scadactl stop --config NAME \| --all [--dry-run] | Stop managed domains | | scadactl status [--details] [--json] | Active domains, sockets, health, drives | | scadactl logs [--domains a,b] [--json] | Per-domain log paths (newest run first) | | scadactl domains [--json] | Domains usable from the current environment | | scadactl run --domain\|--domains -- CMD | Run with process-local CUDA + SCADA env | | scadactl env --domain\|--domains [--json] | Print exports / JSON (domain_count) | | scadactl check-client --domain NAME | Container visibility diagnostic + docker fix | | scadactl doctor [--logs] | Host + domain checks, registry vs live state |
Preview model (kubectl-style): `validate` answers "is the config correct?"; `apply --dry-run` is the single preview of what would change (add --commands for the exact backend invocations, --json for machine output); `apply` executes.
Reconciliation (what apply does on re-run)
apply reconciles the delta toward a config's desired state instead of blindly replaying setup. On re-run, each resource resolves to one of these outcomes:
- Unchanged re-apply (config matches the registry, all domains healthy) → no-op: exits success, changes nothing.
- Edited active config → refused: an active config is immutable in place (the registry, not the edited file, is the comparison basis). Stop the config first (
scadactl stop --config), then apply the new version. - Resource held by another active config → hard error:
applynever seizes a managed resource. Stop the owning config first. - Unmanaged orphan (on host but not in registry) → reclaimed: torn down and...
Excerpt shown — open the source for the full document.