Batch & evaluation¶
Batch execution and manifest types.
BatchRunner
¶
Execute jobs with resume-aware manifest updates.
The worker must be pickleable when max_workers is greater than one.
Methods:
| Name | Description |
|---|---|
run |
Run jobs, skip existing outputs, and update a manifest incrementally. |
Functions¶
run
¶
run(
jobs: Iterable[BatchJob],
worker: BatchWorker,
*,
manifest_path: str | Path,
max_workers: int = 1,
force: bool = False,
input_dir: Path | None = None,
output_dir: Path | None = None,
pattern: str = "",
) -> BatchManifest
Run jobs, skip existing outputs, and update a manifest incrementally.
Loads an existing manifest at manifest_path when present so reruns can
resume. Jobs whose output already exists are marked skipped unless
force is true. After each completed (or skipped) job the manifest is
rewritten so partial progress survives interruption.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
Iterable[BatchJob]
|
Iterable of retargeting jobs to execute. |
required |
worker
|
BatchWorker
|
Pickleable callable invoked per pending job; must accept a
:class: |
required |
manifest_path
|
str | Path
|
JSON manifest path updated after each job finishes. |
required |
max_workers
|
int
|
Process pool size; |
1
|
force
|
bool
|
When true, rerun jobs even if |
False
|
input_dir
|
Path | None
|
Optional batch input root stored on the manifest. |
None
|
output_dir
|
Path | None
|
Optional batch output root stored on the manifest. |
None
|
pattern
|
str
|
Optional glob or filter label stored on the manifest. |
''
|
Returns:
| Type | Description |
|---|---|
BatchManifest
|
Final manifest aggregating all job records and summary counts. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
BatchJob
¶
Bases: BaseModel
One retargeting job in a batch run.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Stable job identifier used in manifests and resume logic. |
motion |
Path
|
Input motion artifact path for the worker. |
output |
Path
|
Expected output artifact path; existing files may be skipped. |
name |
str | None
|
Optional display name; defaults to |
motion_format |
MotionFormatKind | None
|
Typed source motion format override. |
robot |
RobotKind | None
|
Typed robot registry override. |
config_path |
Path | None
|
Optional declarative experiment config. |
provenance |
dict[str, Any]
|
Origin and scheduling history for the job. |
BatchManifest
¶
Bases: BaseModel
Manifest written by resumable batch runs.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_version |
int
|
Manifest format version for forward compatibility. |
created_at |
datetime
|
UTC time when the batch run first started. |
updated_at |
datetime
|
UTC time of the most recent manifest write. |
input_dir |
Path | None
|
Root directory scanned for input motions, if known. |
output_dir |
Path | None
|
Root directory for written outputs, if known. |
pattern |
str
|
Glob or filter pattern used to build the job list. |
total |
int
|
Number of jobs in the batch definition. |
success_count |
int
|
Jobs that completed with :attr: |
skipped_count |
int
|
Jobs skipped because outputs already existed. |
failed_count |
int
|
Jobs that raised during execution. |
records |
tuple[BatchRunRecord, ...]
|
Per-job outcomes in submission order. |
Methods:
| Name | Description |
|---|---|
from_records |
Build a manifest and derive summary counts from records. |
load |
Load a manifest JSON file. |
save_json |
Save manifest JSON. |
records_by_id |
Return records keyed by job id. |
Attributes¶
model_config
class-attribute
instance-attribute
¶
model_config = ConfigDict(arbitrary_types_allowed=True)
Functions¶
from_records
classmethod
¶
from_records(
*,
records: Iterable[BatchRunRecord],
total: int,
created_at: datetime,
input_dir: Path | None = None,
output_dir: Path | None = None,
pattern: str = "",
) -> BatchManifest
Build a manifest and derive summary counts from records.
BatchRunRecord
¶
Bases: BaseModel
Recorded outcome for one batch job.
Attributes:
| Name | Type | Description |
|---|---|---|
job_id |
str
|
Identifier matching :attr: |
motion |
Path
|
Input path from the job definition. |
output |
Path
|
Output path from the job definition. |
status |
RunStatus
|
Terminal status (success, skipped, or failed). |
started_at |
datetime
|
UTC timestamp when execution began. |
finished_at |
datetime
|
UTC timestamp when execution completed. |
message |
str
|
Human-readable summary or error text. |
error_type |
str | None
|
Exception class name when |
provenance |
dict[str, Any]
|
Worker-returned processing history or resume information. |