reader-workbench 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reader_workbench/__init__.py +22 -0
- reader_workbench/__main__.py +4 -0
- reader_workbench/_version.py +17 -0
- reader_workbench/api/__init__.py +74 -0
- reader_workbench/api/_record_reads.py +75 -0
- reader_workbench/api/artifacts.py +79 -0
- reader_workbench/api/facade.py +538 -0
- reader_workbench/api/models.py +285 -0
- reader_workbench/api/notebooks.py +63 -0
- reader_workbench/contracts/__init__.py +18 -0
- reader_workbench/contracts/builtins/__init__.py +36 -0
- reader_workbench/contracts/builtins/cytometry.py +140 -0
- reader_workbench/contracts/builtins/four_state_event_window.py +214 -0
- reader_workbench/contracts/builtins/generic.py +21 -0
- reader_workbench/contracts/builtins/logic.py +149 -0
- reader_workbench/contracts/builtins/plate_reader.py +47 -0
- reader_workbench/contracts/catalog.py +257 -0
- reader_workbench/contracts/model.py +109 -0
- reader_workbench/domains/__init__.py +1 -0
- reader_workbench/domains/cytometry/__init__.py +3 -0
- reader_workbench/domains/cytometry/analysis/__init__.py +29 -0
- reader_workbench/domains/cytometry/analysis/events.py +182 -0
- reader_workbench/domains/cytometry/analysis/gating.py +175 -0
- reader_workbench/domains/cytometry/analysis/workflow.py +248 -0
- reader_workbench/domains/cytometry/io/__init__.py +3 -0
- reader_workbench/domains/cytometry/io/fcs.py +135 -0
- reader_workbench/domains/cytometry/plots/__init__.py +5 -0
- reader_workbench/domains/cytometry/plots/diagnostic.py +155 -0
- reader_workbench/domains/logic/__init__.py +3 -0
- reader_workbench/domains/logic/crosstalk/__init__.py +3 -0
- reader_workbench/domains/logic/crosstalk/pairs.py +661 -0
- reader_workbench/domains/logic/four_state_vector/__init__.py +7 -0
- reader_workbench/domains/logic/four_state_vector/builder.py +321 -0
- reader_workbench/domains/logic/four_state_vector/collection/__init__.py +20 -0
- reader_workbench/domains/logic/four_state_vector/collection/checks.py +49 -0
- reader_workbench/domains/logic/four_state_vector/collection/constants.py +29 -0
- reader_workbench/domains/logic/four_state_vector/collection/model.py +19 -0
- reader_workbench/domains/logic/four_state_vector/collection/render.py +383 -0
- reader_workbench/domains/logic/four_state_vector/collection/sources.py +185 -0
- reader_workbench/domains/logic/four_state_vector/config.py +214 -0
- reader_workbench/domains/logic/four_state_vector/diagnostic.py +361 -0
- reader_workbench/domains/logic/four_state_vector/heatmap.py +86 -0
- reader_workbench/domains/logic/four_state_vector/math.py +191 -0
- reader_workbench/domains/logic/four_state_vector/reference.py +85 -0
- reader_workbench/domains/logic/four_state_vector/selection.py +228 -0
- reader_workbench/domains/logic/four_state_vector/treatment_semantics.py +51 -0
- reader_workbench/domains/logic/four_state_vector/validation.py +19 -0
- reader_workbench/domains/logic/logic_symmetry/__init__.py +3 -0
- reader_workbench/domains/logic/logic_symmetry/encodings.py +93 -0
- reader_workbench/domains/logic/logic_symmetry/extract_corners.py +192 -0
- reader_workbench/domains/logic/logic_symmetry/main.py +236 -0
- reader_workbench/domains/logic/logic_symmetry/metrics.py +96 -0
- reader_workbench/domains/logic/logic_symmetry/overlay.py +129 -0
- reader_workbench/domains/logic/logic_symmetry/prep.py +138 -0
- reader_workbench/domains/logic/logic_symmetry/render.py +356 -0
- reader_workbench/domains/logic/treatment_columns.py +42 -0
- reader_workbench/domains/plate_reader/__init__.py +1 -0
- reader_workbench/domains/plate_reader/analysis/__init__.py +14 -0
- reader_workbench/domains/plate_reader/analysis/fold_change.py +474 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/__init__.py +21 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/aggregation.py +191 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/contract_fields.py +50 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/contracts.py +320 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/design_dispositions.py +54 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/disposition_records.py +140 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/event_sensitivity.py +27 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/materialize.py +274 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/observation_resampling.py +97 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/reduction.py +62 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/seeds.py +15 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/sources.py +308 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/well_exclusion_validation.py +94 -0
- reader_workbench/domains/plate_reader/analysis/four_state_event_window/well_exclusions.py +54 -0
- reader_workbench/domains/plate_reader/analysis/timepoints.py +76 -0
- reader_workbench/domains/plate_reader/io/__init__.py +6 -0
- reader_workbench/domains/plate_reader/io/sample_map.py +65 -0
- reader_workbench/domains/plate_reader/io/synergy_h1/__init__.py +6 -0
- reader_workbench/domains/plate_reader/io/synergy_h1/_kinetic.py +141 -0
- reader_workbench/domains/plate_reader/io/synergy_h1/_parser.py +295 -0
- reader_workbench/domains/plate_reader/io/synergy_h1/_shared.py +195 -0
- reader_workbench/domains/plate_reader/io/synergy_h1/_snapshot.py +130 -0
- reader_workbench/domains/plate_reader/ordering.py +59 -0
- reader_workbench/domains/plate_reader/plots/__init__.py +15 -0
- reader_workbench/domains/plate_reader/plots/_data.py +29 -0
- reader_workbench/domains/plate_reader/plots/common.py +346 -0
- reader_workbench/domains/plate_reader/plots/distributions.py +324 -0
- reader_workbench/domains/plate_reader/plots/dual_reporter_triptych.py +525 -0
- reader_workbench/domains/plate_reader/plots/dual_reporter_triptych_render.py +195 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/__init__.py +26 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic.py +295 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_components.py +149 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_render.py +308 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_style.py +51 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/schema.py +8 -0
- reader_workbench/domains/plate_reader/plots/four_state_event_window/summary.py +140 -0
- reader_workbench/domains/plate_reader/plots/grouping.py +53 -0
- reader_workbench/domains/plate_reader/plots/panels/__init__.py +12 -0
- reader_workbench/domains/plate_reader/plots/panels/snapshot.py +161 -0
- reader_workbench/domains/plate_reader/plots/panels/snapshot_data.py +91 -0
- reader_workbench/domains/plate_reader/plots/panels/time_series.py +296 -0
- reader_workbench/domains/plate_reader/plots/single_reporter_diagnostic.py +435 -0
- reader_workbench/domains/plate_reader/plots/single_reporter_diagnostic_render.py +300 -0
- reader_workbench/domains/plate_reader/plots/snapshot_barplot/__init__.py +315 -0
- reader_workbench/domains/plate_reader/plots/snapshot_barplot/planning.py +168 -0
- reader_workbench/domains/plate_reader/plots/snapshot_heatmap/__init__.py +205 -0
- reader_workbench/domains/plate_reader/plots/snapshot_heatmap/inputs.py +103 -0
- reader_workbench/domains/plate_reader/plots/time_series.py +317 -0
- reader_workbench/domains/plate_reader/plots/ts_and_snap/__init__.py +479 -0
- reader_workbench/domains/plate_reader/plots/ts_and_snap/planning.py +283 -0
- reader_workbench/domains/time_series/__init__.py +29 -0
- reader_workbench/domains/time_series/aggregation.py +60 -0
- reader_workbench/domains/time_series/contracts.py +368 -0
- reader_workbench/domains/time_series/reduction.py +395 -0
- reader_workbench/errors.py +55 -0
- reader_workbench/maintenance/__init__.py +6 -0
- reader_workbench/maintenance/docs.py +335 -0
- reader_workbench/maintenance/model.py +28 -0
- reader_workbench/maintenance/release.py +39 -0
- reader_workbench/maintenance/skills.py +124 -0
- reader_workbench/plotting/__init__.py +20 -0
- reader_workbench/plotting/mpl.py +56 -0
- reader_workbench/plotting/sinks.py +69 -0
- reader_workbench/plotting/style.py +175 -0
- reader_workbench/plotting/utils.py +27 -0
- reader_workbench/plugins/__init__.py +1 -0
- reader_workbench/plugins/catalog.py +33 -0
- reader_workbench/plugins/export/__init__.py +0 -0
- reader_workbench/plugins/export/_paths.py +21 -0
- reader_workbench/plugins/export/csv.py +41 -0
- reader_workbench/plugins/export/xlsx.py +44 -0
- reader_workbench/plugins/ingest/__init__.py +0 -0
- reader_workbench/plugins/ingest/_discovery.py +58 -0
- reader_workbench/plugins/ingest/discovery_policy.py +66 -0
- reader_workbench/plugins/ingest/flow_cytometer.py +139 -0
- reader_workbench/plugins/ingest/synergy_h1.py +234 -0
- reader_workbench/plugins/manifests/__init__.py +1 -0
- reader_workbench/plugins/manifests/export.py +29 -0
- reader_workbench/plugins/manifests/ingest.py +29 -0
- reader_workbench/plugins/manifests/plot.py +161 -0
- reader_workbench/plugins/manifests/transform.py +172 -0
- reader_workbench/plugins/manifests/validator.py +18 -0
- reader_workbench/plugins/plot/__init__.py +0 -0
- reader_workbench/plugins/plot/_shared.py +55 -0
- reader_workbench/plugins/plot/cytometry_diagnostic.py +54 -0
- reader_workbench/plugins/plot/distributions.py +58 -0
- reader_workbench/plugins/plot/dual_reporter_triptych.py +224 -0
- reader_workbench/plugins/plot/four_state_event_window_diagnostic.py +133 -0
- reader_workbench/plugins/plot/four_state_event_window_summary.py +53 -0
- reader_workbench/plugins/plot/four_state_vector_collection.py +45 -0
- reader_workbench/plugins/plot/four_state_vector_diagnostic.py +105 -0
- reader_workbench/plugins/plot/four_state_vector_heatmap.py +63 -0
- reader_workbench/plugins/plot/logic_symmetry.py +56 -0
- reader_workbench/plugins/plot/single_reporter_diagnostic.py +279 -0
- reader_workbench/plugins/plot/snapshot_barplot.py +65 -0
- reader_workbench/plugins/plot/snapshot_heatmap.py +104 -0
- reader_workbench/plugins/plot/time_series.py +114 -0
- reader_workbench/plugins/plot/ts_and_snap.py +210 -0
- reader_workbench/plugins/transform/__init__.py +0 -0
- reader_workbench/plugins/transform/_four_state_vector.py +204 -0
- reader_workbench/plugins/transform/_labeling.py +109 -0
- reader_workbench/plugins/transform/alias.py +70 -0
- reader_workbench/plugins/transform/assay_labels.py +62 -0
- reader_workbench/plugins/transform/blank.py +79 -0
- reader_workbench/plugins/transform/crosstalk_pairs.py +180 -0
- reader_workbench/plugins/transform/cytometry_gating.py +120 -0
- reader_workbench/plugins/transform/fold_change.py +79 -0
- reader_workbench/plugins/transform/four_state_event_window.py +93 -0
- reader_workbench/plugins/transform/four_state_vector.py +62 -0
- reader_workbench/plugins/transform/four_state_vector_collection.py +41 -0
- reader_workbench/plugins/transform/logic_symmetry.py +67 -0
- reader_workbench/plugins/transform/outlier_filter.py +60 -0
- reader_workbench/plugins/transform/overflow.py +197 -0
- reader_workbench/plugins/transform/ratio.py +237 -0
- reader_workbench/plugins/transform/sample_map.py +170 -0
- reader_workbench/plugins/transform/sample_metadata.py +94 -0
- reader_workbench/plugins/validator/__init__.py +1 -0
- reader_workbench/plugins/validator/to_tidy_plus_map.py +155 -0
- reader_workbench/protocols/__init__.py +80 -0
- reader_workbench/protocols/_builtins_plate_reader_growth.py +179 -0
- reader_workbench/protocols/_builtins_plate_reader_variants.py +274 -0
- reader_workbench/protocols/builtins.py +1656 -0
- reader_workbench/protocols/compiler.py +22 -0
- reader_workbench/protocols/compilers/__init__.py +1 -0
- reader_workbench/protocols/compilers/common.py +100 -0
- reader_workbench/protocols/compilers/cytometry.py +87 -0
- reader_workbench/protocols/compilers/generic.py +14 -0
- reader_workbench/protocols/compilers/logic.py +245 -0
- reader_workbench/protocols/compilers/plate_reader.py +937 -0
- reader_workbench/protocols/compilers/plate_reader_pipeline.py +197 -0
- reader_workbench/protocols/model.py +1486 -0
- reader_workbench/protocols/semantic_coverage.py +234 -0
- reader_workbench/runtime/__init__.py +12 -0
- reader_workbench/runtime/builtin.py +23 -0
- reader_workbench/runtime/model.py +42 -0
- reader_workbench/workbench/__init__.py +60 -0
- reader_workbench/workbench/assets/__init__.py +22 -0
- reader_workbench/workbench/assets/types.py +118 -0
- reader_workbench/workbench/audit/__init__.py +5 -0
- reader_workbench/workbench/audit/experiments.py +307 -0
- reader_workbench/workbench/audit/staging.py +187 -0
- reader_workbench/workbench/cli/__init__.py +51 -0
- reader_workbench/workbench/cli/_lazy.py +9 -0
- reader_workbench/workbench/cli/_records_view.py +150 -0
- reader_workbench/workbench/cli/_surface_execution.py +443 -0
- reader_workbench/workbench/cli/audit.py +95 -0
- reader_workbench/workbench/cli/automation.py +229 -0
- reader_workbench/workbench/cli/demo.py +46 -0
- reader_workbench/workbench/cli/dop.py +91 -0
- reader_workbench/workbench/cli/experiments.py +635 -0
- reader_workbench/workbench/cli/helpers.py +232 -0
- reader_workbench/workbench/cli/main.py +59 -0
- reader_workbench/workbench/cli/maintenance.py +82 -0
- reader_workbench/workbench/cli/notebooks.py +260 -0
- reader_workbench/workbench/cli/pagination.py +117 -0
- reader_workbench/workbench/cli/protocols.py +336 -0
- reader_workbench/workbench/cli/shared.py +309 -0
- reader_workbench/workbench/cli/surfaces.py +534 -0
- reader_workbench/workbench/cli/verification.py +128 -0
- reader_workbench/workbench/commands.py +10 -0
- reader_workbench/workbench/config/__init__.py +47 -0
- reader_workbench/workbench/config/identity.py +13 -0
- reader_workbench/workbench/config/load.py +405 -0
- reader_workbench/workbench/config/model.py +274 -0
- reader_workbench/workbench/context.py +26 -0
- reader_workbench/workbench/decl/__init__.py +31 -0
- reader_workbench/workbench/decl/build.py +190 -0
- reader_workbench/workbench/decl/model.py +81 -0
- reader_workbench/workbench/dop/__init__.py +12 -0
- reader_workbench/workbench/dop/builtins.py +261 -0
- reader_workbench/workbench/dop/model.py +209 -0
- reader_workbench/workbench/engine/__init__.py +42 -0
- reader_workbench/workbench/engine/_shared.py +76 -0
- reader_workbench/workbench/engine/contracts.py +283 -0
- reader_workbench/workbench/engine/execution.py +326 -0
- reader_workbench/workbench/engine/file_outputs.py +260 -0
- reader_workbench/workbench/engine/inputs.py +161 -0
- reader_workbench/workbench/engine/invocations.py +507 -0
- reader_workbench/workbench/engine/planning.py +72 -0
- reader_workbench/workbench/engine/runtime.py +464 -0
- reader_workbench/workbench/engine/setup.py +149 -0
- reader_workbench/workbench/engine/validation.py +684 -0
- reader_workbench/workbench/experiment/__init__.py +47 -0
- reader_workbench/workbench/experiment/model.py +381 -0
- reader_workbench/workbench/experiments.py +133 -0
- reader_workbench/workbench/graph/__init__.py +47 -0
- reader_workbench/workbench/graph/nodes.py +102 -0
- reader_workbench/workbench/graph/normalize.py +177 -0
- reader_workbench/workbench/graph/refs.py +148 -0
- reader_workbench/workbench/input_discovery.py +19 -0
- reader_workbench/workbench/inspection/__init__.py +3 -0
- reader_workbench/workbench/inspection/catalogs.py +128 -0
- reader_workbench/workbench/inspection/common.py +92 -0
- reader_workbench/workbench/inspection/dop.py +64 -0
- reader_workbench/workbench/inspection/experiments.py +449 -0
- reader_workbench/workbench/inspection/inventory.py +68 -0
- reader_workbench/workbench/inspection/protocols.py +368 -0
- reader_workbench/workbench/inspection/readiness.py +333 -0
- reader_workbench/workbench/inspection/reports.py +367 -0
- reader_workbench/workbench/inspection/results.py +166 -0
- reader_workbench/workbench/inspection/runtime.py +287 -0
- reader_workbench/workbench/inspection/semantics.py +192 -0
- reader_workbench/workbench/inspection/validation.py +30 -0
- reader_workbench/workbench/notebooks/__init__.py +17 -0
- reader_workbench/workbench/notebooks/_launch_registry.py +112 -0
- reader_workbench/workbench/notebooks/_launch_runtime.py +104 -0
- reader_workbench/workbench/notebooks/components/__init__.py +21 -0
- reader_workbench/workbench/notebooks/components/deliverables.py +403 -0
- reader_workbench/workbench/notebooks/components/overview.py +119 -0
- reader_workbench/workbench/notebooks/eda.marimo.py.txt +153 -0
- reader_workbench/workbench/notebooks/launch.py +274 -0
- reader_workbench/workbench/notebooks/presentation.py +136 -0
- reader_workbench/workbench/notebooks/scaffold.py +60 -0
- reader_workbench/workbench/ontology.py +78 -0
- reader_workbench/workbench/paths.py +44 -0
- reader_workbench/workbench/ports/__init__.py +31 -0
- reader_workbench/workbench/ports/model.py +168 -0
- reader_workbench/workbench/records/__init__.py +44 -0
- reader_workbench/workbench/records/epoch.py +329 -0
- reader_workbench/workbench/records/evidence.py +247 -0
- reader_workbench/workbench/records/identity.py +87 -0
- reader_workbench/workbench/records/locking.py +185 -0
- reader_workbench/workbench/records/model.py +711 -0
- reader_workbench/workbench/records/sources.py +73 -0
- reader_workbench/workbench/records/store.py +1022 -0
- reader_workbench/workbench/records/verification.py +998 -0
- reader_workbench/workbench/registry.py +333 -0
- reader_workbench/workbench/spec_overrides.py +215 -0
- reader_workbench-1.0.0.dist-info/METADATA +91 -0
- reader_workbench-1.0.0.dist-info/RECORD +293 -0
- reader_workbench-1.0.0.dist-info/WHEEL +5 -0
- reader_workbench-1.0.0.dist-info/entry_points.txt +2 -0
- reader_workbench-1.0.0.dist-info/licenses/LICENSE +21 -0
- reader_workbench-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from rich import box
|
|
7
|
+
from rich.panel import Panel
|
|
8
|
+
from rich.table import Table
|
|
9
|
+
|
|
10
|
+
from reader_workbench.errors import ReaderError
|
|
11
|
+
|
|
12
|
+
from . import shared
|
|
13
|
+
from ._lazy import load as _load
|
|
14
|
+
from .helpers import (
|
|
15
|
+
ensure_active_lifecycle,
|
|
16
|
+
find_nearest_experiments_dir,
|
|
17
|
+
format_job_arg,
|
|
18
|
+
indexed_jobs,
|
|
19
|
+
infer_job_path,
|
|
20
|
+
load_job_models,
|
|
21
|
+
resolve_pipeline_step_id,
|
|
22
|
+
)
|
|
23
|
+
from .shared import (
|
|
24
|
+
app,
|
|
25
|
+
checkmark,
|
|
26
|
+
emit_json,
|
|
27
|
+
emit_json_error,
|
|
28
|
+
handle_reader_error,
|
|
29
|
+
normalize_flag,
|
|
30
|
+
normalize_lifecycle_filter,
|
|
31
|
+
normalize_output_format,
|
|
32
|
+
normalize_status_filter,
|
|
33
|
+
table,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@app.command(help="List experiments under a root (default: ./experiments).")
|
|
38
|
+
def ls(
|
|
39
|
+
root: str = typer.Option(
|
|
40
|
+
"./experiments",
|
|
41
|
+
"--root",
|
|
42
|
+
metavar="DIR",
|
|
43
|
+
help="Directory to search recursively for experiment directories.",
|
|
44
|
+
),
|
|
45
|
+
include_scaffolds: bool = typer.Option(
|
|
46
|
+
False,
|
|
47
|
+
"--all",
|
|
48
|
+
help="Include scaffold and template directories too.",
|
|
49
|
+
),
|
|
50
|
+
protocol: str | None = typer.Option(
|
|
51
|
+
None, "--protocol", metavar="ID", help="Only show experiments bound to the given protocol id."
|
|
52
|
+
),
|
|
53
|
+
status: str | None = typer.Option(
|
|
54
|
+
None,
|
|
55
|
+
"--status",
|
|
56
|
+
metavar="STATE",
|
|
57
|
+
help="Only show experiments with status: ok | config_error.",
|
|
58
|
+
),
|
|
59
|
+
lifecycle: str | None = typer.Option(
|
|
60
|
+
None,
|
|
61
|
+
"--lifecycle",
|
|
62
|
+
metavar="KIND",
|
|
63
|
+
help="Only show experiments with lifecycle: active | draft | template.",
|
|
64
|
+
),
|
|
65
|
+
details: bool = typer.Option(
|
|
66
|
+
False,
|
|
67
|
+
"--details",
|
|
68
|
+
help="Show protocol id, selected steps, and generated output counts for each experiment.",
|
|
69
|
+
),
|
|
70
|
+
readiness: bool = typer.Option(
|
|
71
|
+
False,
|
|
72
|
+
"--readiness",
|
|
73
|
+
help="With --details, run preflight and records checks for each experiment.",
|
|
74
|
+
),
|
|
75
|
+
format: str = typer.Option(
|
|
76
|
+
"table",
|
|
77
|
+
"--format",
|
|
78
|
+
metavar="FMT",
|
|
79
|
+
help="Output format: table | json (default: table).",
|
|
80
|
+
),
|
|
81
|
+
limit: int | None = typer.Option(
|
|
82
|
+
None,
|
|
83
|
+
"--limit",
|
|
84
|
+
metavar="N",
|
|
85
|
+
help="Maximum experiments per JSON page (default: 25; maximum: 100).",
|
|
86
|
+
),
|
|
87
|
+
continuation: str | None = typer.Option(
|
|
88
|
+
None,
|
|
89
|
+
"--continuation",
|
|
90
|
+
metavar="TOKEN",
|
|
91
|
+
help="Opaque continuation token from a previous JSON page.",
|
|
92
|
+
),
|
|
93
|
+
):
|
|
94
|
+
include_scaffolds = normalize_flag(include_scaffolds)
|
|
95
|
+
details = normalize_flag(details)
|
|
96
|
+
readiness = normalize_flag(readiness)
|
|
97
|
+
fmt = normalize_output_format(format)
|
|
98
|
+
limit, continuation = shared.normalize_paging_options(limit, continuation)
|
|
99
|
+
shared.require_json_paging(format=fmt, limit=limit, continuation=continuation)
|
|
100
|
+
protocol_filter = protocol.strip() if isinstance(protocol, str) and protocol.strip() else None
|
|
101
|
+
status_filter = normalize_status_filter(status)
|
|
102
|
+
lifecycle_filter = normalize_lifecycle_filter(lifecycle)
|
|
103
|
+
if readiness and not details:
|
|
104
|
+
raise typer.BadParameter("--readiness requires --details")
|
|
105
|
+
|
|
106
|
+
root_path = (
|
|
107
|
+
find_nearest_experiments_dir(Path.cwd()) if str(root).strip() == "./experiments" else Path(root).resolve()
|
|
108
|
+
)
|
|
109
|
+
if not root_path.exists() or not root_path.is_dir():
|
|
110
|
+
raise typer.BadParameter(f"Experiments root not found: {root_path}")
|
|
111
|
+
job_inventory = indexed_jobs(root_path, include_scaffolds=include_scaffolds)
|
|
112
|
+
jobs = [job_path for _, job_path in job_inventory]
|
|
113
|
+
inspection_common = _load("reader_workbench.workbench.inspection.common")
|
|
114
|
+
inspection_inventory = _load("reader_workbench.workbench.inspection.inventory")
|
|
115
|
+
inspection_readiness = _load("reader_workbench.workbench.inspection.readiness")
|
|
116
|
+
inspection_runtime = _load("reader_workbench.workbench.inspection.runtime")
|
|
117
|
+
|
|
118
|
+
def emit_inventory_json(experiments: list[dict[str, object]]) -> None:
|
|
119
|
+
payload = inspection_inventory.inventory_surface_payload(
|
|
120
|
+
root=root_path,
|
|
121
|
+
include_scaffolds=include_scaffolds,
|
|
122
|
+
details=details,
|
|
123
|
+
readiness=readiness,
|
|
124
|
+
protocol=protocol_filter,
|
|
125
|
+
status=status_filter,
|
|
126
|
+
lifecycle=lifecycle_filter,
|
|
127
|
+
experiments=experiments,
|
|
128
|
+
)
|
|
129
|
+
page = shared.page_json_collection(
|
|
130
|
+
experiments,
|
|
131
|
+
key=lambda item: str(item["config"]),
|
|
132
|
+
surface="experiments",
|
|
133
|
+
selection={
|
|
134
|
+
"root": str(root_path),
|
|
135
|
+
"include_scaffolds": include_scaffolds,
|
|
136
|
+
"details": details,
|
|
137
|
+
"readiness": readiness,
|
|
138
|
+
"protocol": protocol_filter,
|
|
139
|
+
"status": status_filter,
|
|
140
|
+
"lifecycle": lifecycle_filter,
|
|
141
|
+
},
|
|
142
|
+
limit=limit,
|
|
143
|
+
continuation=continuation,
|
|
144
|
+
)
|
|
145
|
+
payload["experiments"] = list(page.items)
|
|
146
|
+
emit_json(
|
|
147
|
+
payload,
|
|
148
|
+
truncated=page.truncated,
|
|
149
|
+
continuation=page.continuation,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
if not jobs:
|
|
153
|
+
if fmt == "json":
|
|
154
|
+
emit_inventory_json([])
|
|
155
|
+
return
|
|
156
|
+
shared.console.print(
|
|
157
|
+
Panel.fit(f"No experiments found under [path]{root_path}[/path].", border_style="warn", box=box.ROUNDED)
|
|
158
|
+
)
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
entries: list[dict[str, object]] = []
|
|
162
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime() if details else None
|
|
163
|
+
for idx, config_path in job_inventory:
|
|
164
|
+
entry: dict[str, object] = {
|
|
165
|
+
"index": idx,
|
|
166
|
+
"name": config_path.parent.name,
|
|
167
|
+
"config": str(config_path),
|
|
168
|
+
"root": str(config_path.parent),
|
|
169
|
+
"protocol": None,
|
|
170
|
+
"lifecycle": None,
|
|
171
|
+
"generated": {"records": 0, "plots": 0, "exports": 0, "notebooks": 0},
|
|
172
|
+
"selected": None,
|
|
173
|
+
"has_outputs": False,
|
|
174
|
+
"status": "ok",
|
|
175
|
+
"error": None,
|
|
176
|
+
"readiness": None,
|
|
177
|
+
}
|
|
178
|
+
try:
|
|
179
|
+
if details:
|
|
180
|
+
spec, decl = load_job_models(config_path, runtime=runtime)
|
|
181
|
+
entry["selected"] = inspection_runtime.selected_plan_payload(spec=spec, decl=decl, runtime=runtime)
|
|
182
|
+
else:
|
|
183
|
+
spec = _load("reader_workbench.workbench.config").ReaderSpec.load(config_path)
|
|
184
|
+
entry["protocol"] = spec.protocol.id
|
|
185
|
+
entry["lifecycle"] = spec.experiment.lifecycle
|
|
186
|
+
outputs_dir = (config_path.parent / spec.paths.outputs).resolve()
|
|
187
|
+
counts = inspection_common.summarize_outputs_dir(
|
|
188
|
+
outputs_dir,
|
|
189
|
+
plots_subdir=spec.paths.plots,
|
|
190
|
+
exports_subdir=spec.paths.exports,
|
|
191
|
+
notebooks_subdir=spec.paths.notebooks,
|
|
192
|
+
)
|
|
193
|
+
entry["generated"] = counts
|
|
194
|
+
entry["has_outputs"] = any(counts.values())
|
|
195
|
+
if details:
|
|
196
|
+
entry["generated_examples"] = {
|
|
197
|
+
"records": inspection_common.preview_output_files(
|
|
198
|
+
outputs_dir / "artifacts", base=config_path.parent
|
|
199
|
+
),
|
|
200
|
+
"plots": inspection_common.preview_output_files(
|
|
201
|
+
inspection_common.resolve_output_subdir(outputs_dir, spec.paths.plots), base=config_path.parent
|
|
202
|
+
),
|
|
203
|
+
"exports": inspection_common.preview_output_files(
|
|
204
|
+
inspection_common.resolve_output_subdir(outputs_dir, spec.paths.exports),
|
|
205
|
+
base=config_path.parent,
|
|
206
|
+
),
|
|
207
|
+
"notebooks": inspection_common.preview_output_files(
|
|
208
|
+
inspection_common.resolve_output_subdir(outputs_dir, spec.paths.notebooks),
|
|
209
|
+
base=config_path.parent,
|
|
210
|
+
),
|
|
211
|
+
}
|
|
212
|
+
if readiness:
|
|
213
|
+
entry["readiness"] = inspection_readiness.experiment_readiness_payload(
|
|
214
|
+
job_path=config_path,
|
|
215
|
+
decl=decl,
|
|
216
|
+
runtime=runtime,
|
|
217
|
+
)
|
|
218
|
+
except ReaderError as err:
|
|
219
|
+
entry["status"] = "config_error"
|
|
220
|
+
entry["error"] = str(err)
|
|
221
|
+
if readiness:
|
|
222
|
+
entry["readiness"] = inspection_readiness.config_error_readiness_payload(str(err))
|
|
223
|
+
if protocol_filter and entry["protocol"] != protocol_filter:
|
|
224
|
+
continue
|
|
225
|
+
if status_filter and entry["status"] != status_filter:
|
|
226
|
+
continue
|
|
227
|
+
if lifecycle_filter and entry["lifecycle"] != lifecycle_filter:
|
|
228
|
+
continue
|
|
229
|
+
entries.append(entry)
|
|
230
|
+
|
|
231
|
+
if not entries:
|
|
232
|
+
if fmt == "json":
|
|
233
|
+
emit_inventory_json([])
|
|
234
|
+
return
|
|
235
|
+
filters = []
|
|
236
|
+
if protocol_filter:
|
|
237
|
+
filters.append(f"protocol={protocol_filter}")
|
|
238
|
+
if status_filter:
|
|
239
|
+
filters.append(f"status={status_filter}")
|
|
240
|
+
if lifecycle_filter:
|
|
241
|
+
filters.append(f"lifecycle={lifecycle_filter}")
|
|
242
|
+
suffix = f" for filters ({', '.join(filters)})" if filters else ""
|
|
243
|
+
shared.console.print(
|
|
244
|
+
Panel.fit(
|
|
245
|
+
f"No experiments found under [path]{root_path}[/path]{suffix}.",
|
|
246
|
+
border_style="warn",
|
|
247
|
+
box=box.ROUNDED,
|
|
248
|
+
)
|
|
249
|
+
)
|
|
250
|
+
return
|
|
251
|
+
|
|
252
|
+
if fmt == "json":
|
|
253
|
+
emit_inventory_json(entries)
|
|
254
|
+
return
|
|
255
|
+
|
|
256
|
+
inventory_summary = inspection_inventory.inventory_summary_payload(entries)
|
|
257
|
+
listing = table("Experiments")
|
|
258
|
+
listing.add_column("#", justify="right", style="muted")
|
|
259
|
+
name_values = [str(entry["name"]) for entry in entries]
|
|
260
|
+
max_name = max((len(name) for name in name_values), default=12)
|
|
261
|
+
max_width = int((shared.console.width or 80) * (0.35 if details else 0.6))
|
|
262
|
+
name_width = max(12, min(max_name + 2, max_width))
|
|
263
|
+
listing.add_column("Name", style="accent", max_width=name_width, overflow="ellipsis")
|
|
264
|
+
if details:
|
|
265
|
+
listing.add_column("Protocol", max_width=28, overflow="ellipsis")
|
|
266
|
+
listing.add_column("Lifecycle", width=10)
|
|
267
|
+
listing.add_column("Status", width=12)
|
|
268
|
+
listing.add_column("Selected", overflow="fold")
|
|
269
|
+
listing.add_column("Generated", overflow="fold")
|
|
270
|
+
if readiness:
|
|
271
|
+
listing.add_column("Readiness", overflow="fold")
|
|
272
|
+
listing.add_column("Issue", overflow="fold")
|
|
273
|
+
else:
|
|
274
|
+
listing.add_column("Outputs", justify="center", width=7)
|
|
275
|
+
|
|
276
|
+
for entry in entries:
|
|
277
|
+
status_value = str(entry["status"])
|
|
278
|
+
generated = dict(entry["generated"])
|
|
279
|
+
if details:
|
|
280
|
+
listing.add_row(
|
|
281
|
+
str(entry["index"]),
|
|
282
|
+
str(entry["name"]),
|
|
283
|
+
str(entry["protocol"] or "—"),
|
|
284
|
+
str(entry["lifecycle"] or "—"),
|
|
285
|
+
status_value,
|
|
286
|
+
inspection_runtime.selected_plan_summary(entry.get("selected") if isinstance(entry, dict) else None),
|
|
287
|
+
inspection_runtime.generated_summary(generated),
|
|
288
|
+
inspection_readiness.readiness_summary_text(entry.get("readiness") if isinstance(entry, dict) else None)
|
|
289
|
+
if readiness
|
|
290
|
+
else "",
|
|
291
|
+
str(entry["error"] or "—"),
|
|
292
|
+
)
|
|
293
|
+
else:
|
|
294
|
+
outputs_cell = "[error]ERR[/error]" if status_value != "ok" else checkmark(bool(entry["has_outputs"]))
|
|
295
|
+
listing.add_row(str(entry["index"]), str(entry["name"]), outputs_cell)
|
|
296
|
+
shared.console.print(
|
|
297
|
+
Panel(
|
|
298
|
+
listing,
|
|
299
|
+
border_style="accent",
|
|
300
|
+
box=box.ROUNDED,
|
|
301
|
+
subtitle=(
|
|
302
|
+
f"[muted]root: [path]{root_path}[/path] — {len(entries)} shown"
|
|
303
|
+
+ (f" (protocol={protocol_filter})" if protocol_filter else "")
|
|
304
|
+
+ (f" (status={status_filter})" if status_filter else "")
|
|
305
|
+
+ (f" (lifecycle={lifecycle_filter})" if lifecycle_filter else "")
|
|
306
|
+
+ "[/muted]"
|
|
307
|
+
),
|
|
308
|
+
)
|
|
309
|
+
)
|
|
310
|
+
if details:
|
|
311
|
+
summary = Table(box=box.ROUNDED, expand=True, show_header=False)
|
|
312
|
+
summary.add_column("Field", style="accent", no_wrap=True)
|
|
313
|
+
summary.add_column("Value")
|
|
314
|
+
summary.add_row("Shown", str(len(entries)))
|
|
315
|
+
summary.add_row(
|
|
316
|
+
"Outputs",
|
|
317
|
+
(
|
|
318
|
+
f"{inventory_summary['outputs']['with_outputs']} with outputs"
|
|
319
|
+
f" • {inventory_summary['outputs']['without_outputs']} without outputs"
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
status_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_status"]).items()]
|
|
323
|
+
summary.add_row("Status", ", ".join(status_bits) if status_bits else "—")
|
|
324
|
+
lifecycle_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_lifecycle"]).items()]
|
|
325
|
+
summary.add_row("Lifecycle", ", ".join(lifecycle_bits) if lifecycle_bits else "—")
|
|
326
|
+
protocol_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_protocol"]).items()]
|
|
327
|
+
summary.add_row("Protocols", ", ".join(protocol_bits) if protocol_bits else "—")
|
|
328
|
+
readiness_bits = [f"{key}={value}" for key, value in dict(inventory_summary.get("by_readiness") or {}).items()]
|
|
329
|
+
if readiness_bits:
|
|
330
|
+
summary.add_row("Readiness", ", ".join(readiness_bits))
|
|
331
|
+
shared.console.print(Panel(summary, border_style="accent", box=box.ROUNDED, title="Experiment summary"))
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
@app.command(help="Inspect one experiment: readiness, inputs, pipeline steps, plots, exports, and generated outputs.")
|
|
335
|
+
def inspect(
|
|
336
|
+
job: str | None = typer.Argument(
|
|
337
|
+
None,
|
|
338
|
+
metavar="[CONFIG]",
|
|
339
|
+
help=shared.JOB_ARG_HELP_WITH_DEFAULT,
|
|
340
|
+
),
|
|
341
|
+
format: str = typer.Option(
|
|
342
|
+
"table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
|
|
343
|
+
),
|
|
344
|
+
section: str | None = typer.Option(
|
|
345
|
+
None,
|
|
346
|
+
"--section",
|
|
347
|
+
metavar="NAME",
|
|
348
|
+
help=("JSON projection: identity | authoring | semantics | plan | compiled | inputs | generated | readiness."),
|
|
349
|
+
),
|
|
350
|
+
):
|
|
351
|
+
try:
|
|
352
|
+
job_path = infer_job_path(job)
|
|
353
|
+
spec, decl = load_job_models(job_path)
|
|
354
|
+
except ReaderError as err:
|
|
355
|
+
handle_reader_error(err)
|
|
356
|
+
fmt = normalize_output_format(format)
|
|
357
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
358
|
+
inspection_experiments = _load("reader_workbench.workbench.inspection.experiments")
|
|
359
|
+
selected_section = shared.normalize_semantic_section(
|
|
360
|
+
section,
|
|
361
|
+
allowed=inspection_experiments.EXPERIMENT_INSPECT_SECTIONS,
|
|
362
|
+
format=fmt,
|
|
363
|
+
)
|
|
364
|
+
payload = inspection_experiments.experiment_inspect_payload(
|
|
365
|
+
job_path=job_path, spec=spec, decl=decl, runtime=runtime
|
|
366
|
+
)
|
|
367
|
+
if fmt == "json":
|
|
368
|
+
if selected_section is not None:
|
|
369
|
+
payload = inspection_experiments.experiment_inspect_section_payload(
|
|
370
|
+
payload,
|
|
371
|
+
section=selected_section,
|
|
372
|
+
)
|
|
373
|
+
emit_json(
|
|
374
|
+
payload,
|
|
375
|
+
projection=f"section:{selected_section}" if selected_section is not None else "full",
|
|
376
|
+
)
|
|
377
|
+
return
|
|
378
|
+
semantic_program = decl.experiment_semantics.protocol_program
|
|
379
|
+
for renderable in _load("reader_workbench.workbench.inspection.reports").experiment_inspect_renderables(
|
|
380
|
+
payload=payload,
|
|
381
|
+
semantic_program=semantic_program,
|
|
382
|
+
):
|
|
383
|
+
shared.console.print(renderable)
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
@app.command(help="Show planned steps and contracts (no execution).")
|
|
387
|
+
def explain(
|
|
388
|
+
job: str | None = typer.Argument(
|
|
389
|
+
None,
|
|
390
|
+
metavar="[CONFIG]",
|
|
391
|
+
help=shared.JOB_ARG_HELP_WITH_DEFAULT,
|
|
392
|
+
),
|
|
393
|
+
format: str = typer.Option(
|
|
394
|
+
"table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
|
|
395
|
+
),
|
|
396
|
+
):
|
|
397
|
+
try:
|
|
398
|
+
job_path = infer_job_path(job)
|
|
399
|
+
spec, decl = load_job_models(job_path)
|
|
400
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
401
|
+
fmt = normalize_output_format(format)
|
|
402
|
+
if fmt == "json":
|
|
403
|
+
emit_json(
|
|
404
|
+
_load("reader_workbench.workbench.inspection.experiments").experiment_explain_payload(
|
|
405
|
+
job_path=job_path, spec=spec, decl=decl, runtime=runtime
|
|
406
|
+
)
|
|
407
|
+
)
|
|
408
|
+
return
|
|
409
|
+
_load("reader_workbench.workbench.engine").explain(decl, console=shared.console, runtime=runtime)
|
|
410
|
+
except ReaderError as err:
|
|
411
|
+
handle_reader_error(err)
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
@app.command(help="Validate config, plugin params, reads wiring, and input files.")
|
|
415
|
+
def validate(
|
|
416
|
+
job: str | None = typer.Argument(
|
|
417
|
+
None,
|
|
418
|
+
metavar="[CONFIG]",
|
|
419
|
+
help=shared.JOB_ARG_HELP_WITH_DEFAULT,
|
|
420
|
+
),
|
|
421
|
+
no_files: bool = typer.Option(False, "--no-files", help="Skip file existence checks (config-only validation)."),
|
|
422
|
+
format: str = typer.Option(
|
|
423
|
+
"table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
|
|
424
|
+
),
|
|
425
|
+
):
|
|
426
|
+
try:
|
|
427
|
+
job_path = infer_job_path(job)
|
|
428
|
+
_, decl = load_job_models(job_path)
|
|
429
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
430
|
+
fmt = normalize_output_format(format)
|
|
431
|
+
if fmt == "json":
|
|
432
|
+
summary = _load("reader_workbench.workbench.engine").validation_summary(
|
|
433
|
+
decl, check_files=not no_files, exp_root=decl.experiment.root, runtime=runtime
|
|
434
|
+
)
|
|
435
|
+
if summary["status"] != "ok":
|
|
436
|
+
errors = list(summary.get("errors") or [])
|
|
437
|
+
emit_json_error(
|
|
438
|
+
code="validation_failed",
|
|
439
|
+
field="experiment",
|
|
440
|
+
reason="; ".join(str(error) for error in errors) or "Experiment validation failed.",
|
|
441
|
+
remediation="Correct the reported configuration, binding, dependency, or input issue, then validate again.",
|
|
442
|
+
)
|
|
443
|
+
raise typer.Exit(code=1)
|
|
444
|
+
emit_json(
|
|
445
|
+
_load("reader_workbench.workbench.inspection.validation").validation_surface_payload(
|
|
446
|
+
experiment=_load("reader_workbench.workbench.inspection.experiments").experiment_identity_payload(
|
|
447
|
+
job_path=job_path, decl=decl
|
|
448
|
+
),
|
|
449
|
+
check_files=not no_files,
|
|
450
|
+
summary=summary,
|
|
451
|
+
)
|
|
452
|
+
)
|
|
453
|
+
return
|
|
454
|
+
summary = _load("reader_workbench.workbench.engine").validate(
|
|
455
|
+
decl,
|
|
456
|
+
console=shared.console,
|
|
457
|
+
check_files=not no_files,
|
|
458
|
+
exp_root=decl.experiment.root,
|
|
459
|
+
runtime=runtime,
|
|
460
|
+
)
|
|
461
|
+
if summary["status"] != "ok":
|
|
462
|
+
raise typer.Exit(code=1)
|
|
463
|
+
except ReaderError as err:
|
|
464
|
+
handle_reader_error(err)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
@app.command(help="Print the config plus compiled runtime plan.")
|
|
468
|
+
def config(
|
|
469
|
+
job: str | None = typer.Argument(
|
|
470
|
+
None,
|
|
471
|
+
metavar="[CONFIG]",
|
|
472
|
+
help=shared.JOB_ARG_HELP_WITH_DEFAULT,
|
|
473
|
+
),
|
|
474
|
+
format: str = typer.Option("yaml", "--format", metavar="FMT", help="Output format: yaml | json (default: yaml)."),
|
|
475
|
+
):
|
|
476
|
+
try:
|
|
477
|
+
job_path = infer_job_path(job)
|
|
478
|
+
spec, decl = load_job_models(job_path)
|
|
479
|
+
except ReaderError as err:
|
|
480
|
+
handle_reader_error(err)
|
|
481
|
+
fmt = str(format).strip().lower()
|
|
482
|
+
if fmt == "json":
|
|
483
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
484
|
+
emit_json(
|
|
485
|
+
_load("reader_workbench.workbench.inspection.experiments").experiment_config_json_payload(
|
|
486
|
+
job_path=job_path, spec=spec, decl=decl, runtime=runtime
|
|
487
|
+
)
|
|
488
|
+
)
|
|
489
|
+
return
|
|
490
|
+
if fmt == "yaml":
|
|
491
|
+
payload = spec.model_dump(by_alias=True)
|
|
492
|
+
materialized = _load("reader_workbench.workbench.graph").materialize_workbench(decl)
|
|
493
|
+
payload["compiled"] = {
|
|
494
|
+
"pipeline": materialized["pipeline"],
|
|
495
|
+
"plots": materialized["plots"],
|
|
496
|
+
"exports": materialized["exports"],
|
|
497
|
+
}
|
|
498
|
+
typer.echo(_load("yaml").safe_dump(payload, sort_keys=False))
|
|
499
|
+
return
|
|
500
|
+
raise typer.BadParameter("format must be 'yaml' or 'json'")
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
@app.command(help="Run pipeline to generate dataframe records.")
|
|
504
|
+
def run(
|
|
505
|
+
job: str | None = typer.Argument(
|
|
506
|
+
None,
|
|
507
|
+
metavar="[CONFIG]",
|
|
508
|
+
help=shared.JOB_ARG_HELP_WITH_DEFAULT,
|
|
509
|
+
),
|
|
510
|
+
from_step: str | None = typer.Option(
|
|
511
|
+
None,
|
|
512
|
+
"--from",
|
|
513
|
+
metavar="STEP_ID",
|
|
514
|
+
help="Start from this pipeline step (inclusive). Use an exact id as declared in the config.",
|
|
515
|
+
),
|
|
516
|
+
until: str | None = typer.Option(
|
|
517
|
+
None,
|
|
518
|
+
"--until",
|
|
519
|
+
metavar="STEP_ID",
|
|
520
|
+
help="Stop after this step (inclusive). Use an exact id as declared in the config.",
|
|
521
|
+
),
|
|
522
|
+
only: str | None = typer.Option(None, "--only", metavar="STEP_ID", help="Run exactly one pipeline step by id."),
|
|
523
|
+
reset_records: bool = typer.Option(
|
|
524
|
+
False,
|
|
525
|
+
"--reset-records",
|
|
526
|
+
help="Start a fresh generated-output epoch before a complete pipeline rerun.",
|
|
527
|
+
),
|
|
528
|
+
dry_run: bool = typer.Option(
|
|
529
|
+
False, "--dry-run", help="Plan only: validate and print the plan without executing steps."
|
|
530
|
+
),
|
|
531
|
+
format: str = typer.Option(
|
|
532
|
+
"table", "--format", metavar="FMT", help="Output format for --dry-run: table | json (default: table)."
|
|
533
|
+
),
|
|
534
|
+
log_level: str = typer.Option(
|
|
535
|
+
"INFO",
|
|
536
|
+
"--log-level",
|
|
537
|
+
metavar="LEVEL",
|
|
538
|
+
help="Logging level: DEBUG | INFO | WARNING | ERROR | CRITICAL (default: INFO).",
|
|
539
|
+
),
|
|
540
|
+
compact: bool = typer.Option(False, "--compact", help="Use concise progress output instead of per-step logs."),
|
|
541
|
+
):
|
|
542
|
+
job_path = infer_job_path(job)
|
|
543
|
+
if only and (from_step or until):
|
|
544
|
+
raise typer.BadParameter("--only cannot be combined with --from/--until")
|
|
545
|
+
if reset_records and (only or from_step or until):
|
|
546
|
+
raise typer.BadParameter("--reset-records requires a complete run without --only, --from, or --until")
|
|
547
|
+
if reset_records and dry_run:
|
|
548
|
+
raise typer.BadParameter("--reset-records cannot be combined with --dry-run")
|
|
549
|
+
|
|
550
|
+
try:
|
|
551
|
+
spec, decl = load_job_models(job_path)
|
|
552
|
+
except ReaderError as err:
|
|
553
|
+
handle_reader_error(err)
|
|
554
|
+
fmt = normalize_output_format(format)
|
|
555
|
+
if fmt == "json" and not dry_run:
|
|
556
|
+
raise typer.BadParameter("--format json is only supported with --dry-run")
|
|
557
|
+
try:
|
|
558
|
+
_load("reader_workbench.workbench.engine").normalize_log_level(log_level)
|
|
559
|
+
except ReaderError as err:
|
|
560
|
+
handle_reader_error(err)
|
|
561
|
+
if not dry_run:
|
|
562
|
+
ensure_active_lifecycle(decl, job_path, command_name="run")
|
|
563
|
+
|
|
564
|
+
if only:
|
|
565
|
+
resolve_pipeline_step_id(decl, only, job_path=job_path)
|
|
566
|
+
try:
|
|
567
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
568
|
+
if dry_run and fmt == "json":
|
|
569
|
+
emit_json(
|
|
570
|
+
_load("reader_workbench.workbench.inspection.experiments").experiment_run_dry_run_payload(
|
|
571
|
+
job_path=job_path,
|
|
572
|
+
spec=spec,
|
|
573
|
+
decl=decl,
|
|
574
|
+
runtime=runtime,
|
|
575
|
+
resume_from=None,
|
|
576
|
+
until=None,
|
|
577
|
+
only=only,
|
|
578
|
+
)
|
|
579
|
+
)
|
|
580
|
+
return
|
|
581
|
+
_load("reader_workbench.workbench.engine").run_job(
|
|
582
|
+
job_path,
|
|
583
|
+
resume_from=only,
|
|
584
|
+
until=only,
|
|
585
|
+
dry_run=dry_run,
|
|
586
|
+
log_level=log_level,
|
|
587
|
+
verbose=not compact,
|
|
588
|
+
console=shared.console,
|
|
589
|
+
include_pipeline=True,
|
|
590
|
+
include_plots=False,
|
|
591
|
+
include_exports=False,
|
|
592
|
+
job_label=format_job_arg(job),
|
|
593
|
+
show_next_steps=True,
|
|
594
|
+
runtime=runtime,
|
|
595
|
+
)
|
|
596
|
+
except ReaderError as err:
|
|
597
|
+
handle_reader_error(err)
|
|
598
|
+
return
|
|
599
|
+
|
|
600
|
+
if from_step:
|
|
601
|
+
resolve_pipeline_step_id(decl, from_step, job_path=job_path)
|
|
602
|
+
if until:
|
|
603
|
+
resolve_pipeline_step_id(decl, until, job_path=job_path)
|
|
604
|
+
try:
|
|
605
|
+
runtime = _load("reader_workbench.runtime").builtin_runtime()
|
|
606
|
+
if dry_run and fmt == "json":
|
|
607
|
+
emit_json(
|
|
608
|
+
_load("reader_workbench.workbench.inspection.experiments").experiment_run_dry_run_payload(
|
|
609
|
+
job_path=job_path,
|
|
610
|
+
spec=spec,
|
|
611
|
+
decl=decl,
|
|
612
|
+
runtime=runtime,
|
|
613
|
+
resume_from=from_step,
|
|
614
|
+
until=until,
|
|
615
|
+
)
|
|
616
|
+
)
|
|
617
|
+
return
|
|
618
|
+
_load("reader_workbench.workbench.engine").run_job(
|
|
619
|
+
job_path,
|
|
620
|
+
resume_from=from_step,
|
|
621
|
+
until=until,
|
|
622
|
+
reset_records=reset_records,
|
|
623
|
+
dry_run=dry_run,
|
|
624
|
+
log_level=log_level,
|
|
625
|
+
verbose=not compact,
|
|
626
|
+
console=shared.console,
|
|
627
|
+
include_pipeline=True,
|
|
628
|
+
include_plots=False,
|
|
629
|
+
include_exports=False,
|
|
630
|
+
job_label=format_job_arg(job),
|
|
631
|
+
show_next_steps=True,
|
|
632
|
+
runtime=runtime,
|
|
633
|
+
)
|
|
634
|
+
except ReaderError as err:
|
|
635
|
+
handle_reader_error(err)
|