CIS490/training/producers/__main__.py
Max 697e36a315 training/producers: move out of dashboard/ per ownership boundary
Producers are event *sources* — the renderer is everything inside
training/dashboard/. Sibling layout makes the dependency direction
one-way (producers import from training.dashboard.events; dashboard
never reaches into producers).

  training/dashboard/producers/   →   training/producers/

Internal imports rewritten via sed; eval_/run.py and training/README.md
cross-references updated. CLI entry stays via `python -m training.producers.<sub>`
(replay / metrics / perf / profiles).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:06:56 -05:00

39 lines
1.2 KiB
Python

"""CLI dispatcher for dashboard producers.
python -m training.producers replay --episode … --host-id …
python -m training.producers metrics --window … --schema …
python -m training.producers perf --window … --schema …
python -m training.producers profiles --validation … --store …
Each subcommand forwards remaining argv to the matching module's main().
"""
from __future__ import annotations
import sys
SUBCOMMANDS = {
"replay": "training.producers.replay",
"metrics": "training.producers.metrics",
"perf": "training.producers.perf",
"profiles": "training.producers.profiles",
}
def main() -> int:
if len(sys.argv) < 2 or sys.argv[1] in {"-h", "--help"}:
print("usage: python -m training.producers "
"<replay|metrics|perf|profiles> [args]", file=sys.stderr)
return 2
sub = sys.argv[1]
if sub not in SUBCOMMANDS:
print(f"unknown subcommand: {sub}", file=sys.stderr)
return 2
import importlib
mod = importlib.import_module(SUBCOMMANDS[sub])
sys.argv = [f"{sys.argv[0]} {sub}"] + sys.argv[2:]
return int(mod.main() or 0)
if __name__ == "__main__":
raise SystemExit(main())