OCDocker.Workbench.Adoption module

Read-only adoption helpers for existing OCDocker output directories.

OCDocker.Workbench.Adoption.build_adoption_plan(source_root, *, max_depth=3, spec_type='ocscore_ablation', status=None, run_id_prefix='', max_metric_file_bytes=1048576, require_metrics=False)[source]

Build a dry-run plan for adopting existing output directories.

Parameters:
  • source_root (str or pathlib.Path) – Existing output root to scan. It is never modified.

  • max_depth (int) – Maximum directory depth below source_root to inspect. OCScore ablation policy directories under an ablations container are included when the parent run directory or container is reached.

  • spec_type (WorkbenchSpecType) – Workbench spec type assigned to adopted run manifests.

  • status (RunStatus or None) – Optional status override. If omitted, completed is used when metrics are found.

  • run_id_prefix (str) – Optional prefix applied to generated run ids.

  • max_metric_file_bytes (int) – Maximum metric file size parsed during adoption planning.

  • require_metrics (bool) – If True, only directories with at least one parsed metric are included.

Returns:

Dry-run adoption plan.

Return type:

WorkbenchAdoptionPlan

OCDocker.Workbench.Adoption.write_adoption_workspace(source_root, destination_root, *, max_depth=3, spec_type='ocscore_ablation', status=None, run_id_prefix='', max_metric_file_bytes=1048576, require_metrics=False, overwrite=False)[source]

Write Workbench manifests for existing output directories.

Parameters:
  • source_root (str or pathlib.Path) – Existing output root to scan. It is never modified.

  • destination_root (str or pathlib.Path) – Workbench root where new manifest directories are written.

  • max_depth (int) – Maximum directory depth below source_root to inspect. OCScore ablation policy directories under an ablations container are included when the parent run directory or container is reached.

  • spec_type (WorkbenchSpecType) – Workbench spec type assigned to adopted run manifests.

  • status (RunStatus or None) – Optional status override.

  • run_id_prefix (str) – Optional prefix applied to generated run ids.

  • max_metric_file_bytes (int) – Maximum metric file size parsed during adoption planning.

  • require_metrics (bool) – If True, only directories with at least one parsed metric are included.

  • overwrite (bool) – Whether existing destination manifests may be overwritten.

Returns:

Summary of written manifests.

Return type:

WorkbenchAdoptionResult

OCScore ablation adoption

The adoption scanner is read-only. It writes Workbench manifests only to the destination workspace and leaves the original OCScore output tree untouched. When the scanner reaches an OCScore ablations/ container, each direct feature-policy directory below it is inspected as an adopted run, even when the regular --max-depth value would otherwise stop at the parent train folder.

This allows an existing train output such as train/ablations/no_shape_core to appear as a separate Workbench run in the dashboard:

ocdocker workbench adopt-plan OCScore/output/train --max-depth 0 --require-metrics --output adoption_plan.json
ocdocker workbench adopt OCScore/output/train workbench-runs --max-depth 0 --require-metrics
ocdocker workbench serve workbench-runs --host 127.0.0.1 --port 8765

The same discovery also works from a parent output root when the train folder is inside the requested depth.

Use --require-metrics when the source tree also contains exported placeholder directories. This keeps the adopted workspace focused on completed result folders and prevents metricless placeholders from consuming duplicate run ids.