bundle.pods.manager

Attributes

Classes

PodSpec

Declarative specification for a single pod.

PodManager

Manages discovery and orchestration of local AI pods.

Module Contents

bundle.pods.manager.log
bundle.pods.manager.PODS_ROOT_ENV = 'BUNDLE_PODS_ROOT'
bundle.pods.manager.IMAGE_PREFIX = 'thebundle'
class bundle.pods.manager.PodSpec(/, **data: Any)[source]

Bases: bundle.core.data.Data

Declarative specification for a single pod.

name

Leaf folder name for display (e.g. “website”, “colmap”).

folder

Subdirectory name under the pods root (legacy compat, same as full_path).

full_path

Relative path from pods root using / separators (e.g. “services/website”).

category

First path segment (e.g. “services”, “bases”, “recon3d”).

service

Docker Compose service name, if the compose file defines one matching the pod name.

buildable

Whether the compose file contains a build: section.

containers

Explicit container_name values parsed from the compose file.

name: str
folder: str
full_path: str = ''
category: str = ''
service: str | None = None
buildable: bool = True
containers: list[str]
class bundle.pods.manager.PodManager(/, **data: Any)[source]

Bases: bundle.core.entity.Entity

Manages discovery and orchestration of local AI pods.

On construction the manager resolves the Docker Compose CLI, scans the pods_root directory recursively for pod folders (each containing a docker-compose.yml), and caches the resulting PodSpec objects.

Pods are identified by their relative path from pods_root using slash notation (e.g. services/website, bases/cpu). Short names are supported when unambiguous.

All compose operations (build, run, down, status, logs) are async and delegate to ProcessStream for streamed output or Process for captured output.

pods_root: pathlib.Path
classmethod create(pods_root: pathlib.Path | str | None = None) → PodManager[source]

Factory that resolves the pods root and returns a ready-to-use manager.

property specs: dict[str, PodSpec]
get(name: str) → PodSpec[source]

Look up a pod by full path or short name (case-insensitive).

Resolution order: 1. Exact full_path match (e.g. services/website) 2. Unique leaf-name match (e.g. website if unambiguous)

Raises ClickException if not found or ambiguous.

pod_path(pod: PodSpec) → pathlib.Path[source]

Resolve and validate the filesystem path for a pod.

async running_containers() → set[str][source]

Query Docker for currently running container names.

static image_tag(spec: PodSpec) → str[source]

Derive the Docker image tag for a pod: thebundle/<full_path>:latest.

static image_name(spec: PodSpec) → str[source]

Derive the Docker image name (without tag) for a pod: thebundle/<full_path>.

categories() → list[str][source]

Return the sorted list of discovered categories.

by_category(category: str) → list[PodSpec][source]

Return all pods belonging to category.

build_order(category: str) → list[PodSpec][source]

Return pods in category sorted by dependency order (topological sort on FROM lines).

Parses each pod’s Dockerfile to determine which sibling it depends on, then sorts so parents are built before children.

async build_category(category: str) → None[source]

Build all buildable pods in category respecting dependency order.

async compose(pod: PodSpec, subcommand: str, stream: bool = False) → bundle.core.process.ProcessResult[source]

Execute a docker compose subcommand against a pod’s compose file.

async build(pod: PodSpec) → bundle.core.process.ProcessResult | None[source]

Build the pod’s Docker image. Skips pods that use prebuilt images only.

async run(pod: PodSpec) → bundle.core.process.ProcessResult[source]

Start a pod in detached mode (up -d).

async down(pod: PodSpec) → bundle.core.process.ProcessResult[source]

Stop and remove a pod’s containers and networks.

async status(pod: PodSpec) → bundle.core.process.ProcessResult[source]

Return the docker compose ps output for a pod.

async logs(pod: PodSpec, follow: bool = True, tail: int = 200) → bundle.core.process.ProcessResult[source]

Stream or show pod container logs.

async exec(pod: PodSpec, command: str, service: str | None = None) → bundle.core.process.ProcessResult[source]

Execute a command inside a running pod container.

Parameters:
  • pod – The pod to exec into.

  • command – The command string to run inside the container.

  • service – Override the service name (defaults to pod.service or pod.name).