Supervisors¶
The three Supervisor implementations that start/stop/restart/healthcheck
plugins, plus the shared protocol.
Protocol & NullSupervisor¶
xcore_agent.agent.install_driver.Supervisor
¶
Bases: Protocol
Source code in xcore_agent/agent/install_driver.py
xcore_agent.agent.install_driver.NullSupervisor
¶
No-op supervisor for dry runs and tests.
Source code in xcore_agent/agent/install_driver.py
SystemdSupervisor¶
Backed by systemctl (optionally systemctl --user).
xcore_agent.agent.systemd_supervisor
¶
A Supervisor (see install_driver.py) backed by systemctl — the
concrete default for a project deployed directly on a VPS, as opposed to
inside Docker/k8s where the client's own orchestrator plays this role (see
README's "what's real vs. stubbed" table).
Expects one systemd unit per plugin, named <unit_prefix><plugin_id>.service
(default prefix xcore-plugin-), plus one project_unit used for steps that
don't name a specific plugin (a project-wide start/stop/restart).
Provisioning those units (writing the .service files, daemon-reload) is a
deployment/ops concern outside this class's scope — it only ever calls
start / stop / restart / is-active on units that already exist.
SystemdCommandError
¶
Bases: Exception
Raised when a systemctl invocation itself fails (bad unit, permission,
systemd not running, ...) — distinct from a healthcheck simply reporting
the unit as not active.
SystemdSupervisor
dataclass
¶
Source code in xcore_agent/agent/systemd_supervisor.py
unit_prefix: str = 'xcore-plugin-'
class-attribute
instance-attribute
¶
project_unit: str = 'xcore-project.service'
class-attribute
instance-attribute
¶
user_scope: bool = True
class-attribute
instance-attribute
¶
healthcheck_poll_interval_seconds: float = 1.0
class-attribute
instance-attribute
¶
__init__(unit_prefix: str = 'xcore-plugin-', project_unit: str = 'xcore-project.service', user_scope: bool = True, healthcheck_poll_interval_seconds: float = 1.0) -> None
¶
start(plugin_id: str | None) -> None
¶
stop(plugin_id: str | None) -> None
¶
restart(plugin_id: str | None) -> None
¶
is_active(plugin_id: str | None) -> bool
¶
healthcheck(plugin_id: str | None, *, timeout_seconds: int, retries: int) -> None
¶
Source code in xcore_agent/agent/systemd_supervisor.py
DockerSupervisor¶
Backed by the docker CLI.
xcore_agent.agent.docker_supervisor
¶
A Supervisor (see install_driver.py) backed by the docker CLI — an
alternative to SystemdSupervisor for projects deployed as containers
instead of directly on the host.
Expects one container per plugin, named <container_prefix><plugin_id>
(default prefix xcore-plugin-), plus one project_container used for
steps that don't name a specific plugin. Creating/updating those containers
(image, env, volumes, docker run vs docker compose, ...) is a
deployment/ops concern outside this class's scope — it only ever calls
start / stop / restart / inspect on containers that already exist.
DockerCommandError
¶
Bases: Exception
Raised when a docker invocation itself fails (unknown container,
daemon not running, permission denied, ...) — distinct from a
healthcheck simply reporting the container as not running.
DockerSupervisor
dataclass
¶
Source code in xcore_agent/agent/docker_supervisor.py
container_prefix: str = 'xcore-plugin-'
class-attribute
instance-attribute
¶
project_container: str = 'xcore-project'
class-attribute
instance-attribute
¶
healthcheck_poll_interval_seconds: float = 1.0
class-attribute
instance-attribute
¶
__init__(container_prefix: str = 'xcore-plugin-', project_container: str = 'xcore-project', healthcheck_poll_interval_seconds: float = 1.0) -> None
¶
start(plugin_id: str | None) -> None
¶
stop(plugin_id: str | None) -> None
¶
restart(plugin_id: str | None) -> None
¶
is_running(plugin_id: str | None) -> bool
¶
healthcheck(plugin_id: str | None, *, timeout_seconds: int, retries: int) -> None
¶
Source code in xcore_agent/agent/docker_supervisor.py
KubernetesSupervisor¶
Backed by the kubectl CLI — scale/rollout-restart/rollout-status, one
Deployment per plugin (xcore-plugin-<id> by default).
xcore_agent.agent.kubernetes_supervisor
¶
A Supervisor (see install_driver.py) backed by the kubectl CLI — an
alternative to SystemdSupervisor/DockerSupervisor for projects deployed
onto a Kubernetes cluster. Same shell-out-to-CLI shape as DockerSupervisor
(no kubernetes Python client dependency), because the agent otherwise has
no way to assume kubeconfig/cluster access is even present.
Expects one Deployment per plugin, named <deployment_prefix><plugin_id>
(default prefix xcore-plugin-) in namespace, plus one
project_deployment for steps that don't name a specific plugin. Creating
those Deployments (image, env, resources, ...) is a deployment/ops concern
outside this class's scope — it only ever scales, restarts, and checks the
rollout status of Deployments that already exist.
Kubernetes has no direct "start/stop a container" verb the way docker
start/docker stop do; the equivalent for a Deployment is scaling replicas
to 1 or 0, and "restart" is kubectl rollout restart, whose completion is
observed via kubectl rollout status — which doubles as the healthcheck.
KubectlCommandError
¶
Bases: Exception
Raised when a kubectl invocation itself fails (unknown deployment,
cluster unreachable, permission denied, ...) — distinct from a
healthcheck simply reporting the rollout as not yet complete.