bundle.pods.manager¶
Attributes¶
Classes¶
Declarative specification for a single pod. |
|
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.DataDeclarative 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_namevalues parsed from the compose file.
- class bundle.pods.manager.PodManager(/, **data: Any)[source]¶
Bases:
bundle.core.entity.EntityManages discovery and orchestration of local AI pods.
On construction the manager resolves the Docker Compose CLI, scans the
pods_rootdirectory recursively for pod folders (each containing adocker-compose.yml), and caches the resultingPodSpecobjects.Pods are identified by their relative path from
pods_rootusing 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
ProcessStreamfor streamed output orProcessfor 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.
- 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.websiteif unambiguous)Raises
ClickExceptionif not found or ambiguous.
- pod_path(pod: PodSpec) pathlib.Path[source]¶
Resolve and validate the filesystem path for a pod.
- 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>.
- 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 psoutput 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).