automaton.container¶
WARNING
This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.
automaton.container
¶
Container management for Automaton.
Manages layered Charliecloud container builds using base, harness, and optional runtime templates, exposing built artifacts through path-like container references.
Automaton is content-free: it does not know where templates live or what
runtime layers exist. Callers supply a :class:ContainerLayout describing:
- the base Dockerfile template,
- how to find a harness's Dockerfile template and enumerate harnesses,
- how to enumerate runtime layers and find their Dockerfile templates and metadata.
The third ("runtime") layer is fully generic here. A benchmark orchestrator might back it with "task groups", but Automaton assigns no such meaning.
ContainerLayout
dataclass
¶
ContainerLayout(base_template_path: Path, harness_template_path: Callable[[str], Path], list_harnesses: Callable[[], list[str]], load_harness: Callable[[str], Harness], list_runtime_layers: Callable[[], list[str]], runtime_layer_metadata: Callable[[str], dict], runtime_template_path: Callable[[str], Path])
Describes where container templates and runtime layers come from.
Automaton stays content-free by delegating all template discovery to the caller through this layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_template_path
|
Path
|
Path to the base Dockerfile template (rendered with |
required |
harness_template_path
|
Callable[[str], Path]
|
Given a harness template name, return its Dockerfile template path. |
required |
list_harnesses
|
Callable[[], list[str]]
|
Return the available harness ids. |
required |
load_harness
|
Callable[[str], Harness]
|
Given a harness id, return a loaded :class: |
required |
list_runtime_layers
|
Callable[[], list[str]]
|
Return the available runtime-layer ids (e.g. task-group ids). |
required |
runtime_layer_metadata
|
Callable[[str], dict]
|
Given a runtime-layer id, return its metadata dict. The manager reads
the optional |
required |
runtime_template_path
|
Callable[[str], Path]
|
Given a runtime-layer template name, return its Dockerfile template path. |
required |
ContainerInfo
dataclass
¶
ContainerInfo(container_id: str, canonical_ref: str, aliases: tuple[str, ...], kind: str, path: Path, exists: bool, size_bytes: int | None = None, build_time: datetime | None = None)
Metadata about a buildable or built container artifact.
size_human
¶
Return human-readable size.
Source code in automaton/container.py
ContainerRef
dataclass
¶
Normalized container reference.
Kinds: base, harness, runtime. For runtime, group_id
holds the runtime-layer id.
ContainerManager
¶
ContainerManager(layout: ContainerLayout, cache_root: Path | None = None, image_prefix: str = DEFAULT_IMAGE_PREFIX, build_force: str | bool | None = True)
Manage layered Charliecloud container builds and lifecycle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout
|
ContainerLayout
|
Describes template locations and runtime-layer discovery. |
required |
cache_root
|
Path
|
Root for built artifacts and image storage. Defaults to the
|
None
|
image_prefix
|
str
|
Prefix for Charliecloud image names. Default |
DEFAULT_IMAGE_PREFIX
|
build_force
|
str | bool | None
|
Controls Charliecloud's
Overridable via the |
True
|
Source code in automaton/container.py
shared_image_storage
property
¶
Shared Charliecloud builder storage for all Automaton images.
check_charliecloud_available
staticmethod
¶
Check if Charliecloud tools are available.
Source code in automaton/container.py
check_mpi_available
staticmethod
¶
Check if an MPI runtime is available (mpi4py can load libmpi).
Source code in automaton/container.py
available_container_refs
¶
available_container_refs() -> list[ContainerRef]
Return all valid container refs known from the layout.
Source code in automaton/container.py
resolve_container_ref
¶
resolve_container_ref(ref: str | ContainerRef) -> ContainerRef
Normalize a user-supplied container ref.
Source code in automaton/container.py
get_container_path
¶
get_container_path(ref: str | ContainerRef) -> Path
Return the on-disk path for a built container artifact.
Source code in automaton/container.py
get_container_info
¶
get_container_info(ref: str | ContainerRef) -> ContainerInfo
Get metadata for a buildable or built container.
Source code in automaton/container.py
list_containers
¶
list_containers(only_built: bool = False) -> dict[str, ContainerInfo]
List all buildable containers keyed by shorthand ref.
Source code in automaton/container.py
find_container_infos
¶
find_container_infos(pattern: str, only_built: bool = False) -> list[ContainerInfo]
Find containers by exact ref or glob pattern.
Source code in automaton/container.py
container_exists
¶
container_exists(ref: str | ContainerRef) -> bool
build_container
¶
build_container(ref: str | ContainerRef, force: bool = False, verbose: bool = True) -> Path
Build the requested container, auto-building parent layers as needed.
Source code in automaton/container.py
delete_container
¶
delete_container(ref: str | ContainerRef, verbose: bool = True) -> bool
Delete a built container artifact.
Source code in automaton/container.py
clear_cache
¶
Remove all Automaton temporary containers and builder storage.