One rebuild list for the refresh, the bot cycle and the daily workflows; graph.json rebuilt
CI / test (pull_request) Canceled after 0s
CI / test (pull_request) Canceled after 0s
- python -m collection rebuild: graph, route model, experiment plan, the Black evidence, the screen tree, statistics, build. refresh, cycle and both update-sources workflows use it, so the morning update also rebuilds the reports the tests check (it rebuilt only graph, model and stats before) - graph.json had not been rebuilt since the played-steps fix (no Node on the Mac) - docs: the branch is pushed; README mentions rebuild Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f8e4f575f4
commit
93bdfcd4da
+23
-22
@@ -73,6 +73,27 @@ def _step(label, cmd):
|
||||
subprocess.run(cmd, cwd=ROOT, check=True)
|
||||
|
||||
|
||||
def rebuild():
|
||||
"""Everything built from the runs, in order. The one list the local refresh, the bot cycle and the daily
|
||||
workflows all use (`python -m collection rebuild`), so a new report only needs adding here."""
|
||||
py = sys.executable
|
||||
if shutil.which("node"):
|
||||
_step("route graph", ["node", "analysis/network/build-graph.js"])
|
||||
else:
|
||||
print("\n(node is not installed: data/public/graph.json is not rebuilt; everything else is)")
|
||||
_step("route model (a few minutes)", [py, "planner/build_policy.py"])
|
||||
_step("experiment plan", [py, "planner/build_experiments.py"])
|
||||
_step("what the runs show about the Black", [py, "analysis/black/evidence.py"])
|
||||
_step("screen tree", [py, "analysis/tree/build_tree.py"])
|
||||
try:
|
||||
import scipy # noqa: F401
|
||||
_step("statistics", [py, "analysis/stats/site_stats.py"])
|
||||
except ImportError:
|
||||
print("\n(scipy is not installed: data/public/stats.json is not rebuilt)")
|
||||
_step("runs, generated files and metadata", [py, "-m", "collection", "build"])
|
||||
return 0
|
||||
|
||||
|
||||
def refresh(update_main, bots=()):
|
||||
"""update -> (graph, policy, stats, build) when something changed. Returns 0 on success."""
|
||||
py = sys.executable
|
||||
@@ -81,16 +102,7 @@ def refresh(update_main, bots=()):
|
||||
rc = update_main(args)
|
||||
for i, b in enumerate(bots):
|
||||
rc |= update_main(["update", "--source", "bot", "--file", f"bot={b}", "--report", str(path(f"exports/last-report-bot{i + 1}.md"))])
|
||||
if shutil.which("node"):
|
||||
_step("route graph", ["node", "analysis/network/build-graph.js"])
|
||||
else:
|
||||
print("\n(node is not installed: data/public/graph.json is not rebuilt; everything else is)")
|
||||
_step("route model (about 2 minutes)", [py, "planner/build_policy.py"])
|
||||
_step("experiment plan", [py, "planner/build_experiments.py"])
|
||||
_step("what the runs show about the Black", [py, "analysis/black/evidence.py"])
|
||||
_step("screen tree", [py, "analysis/tree/build_tree.py"])
|
||||
_step("statistics", [py, "analysis/stats/site_stats.py"])
|
||||
_step("runs, generated files and metadata", [py, "-m", "collection", "build"])
|
||||
rebuild()
|
||||
print(f"\nDone. What changed: exports/last-report.md. Send the bot its files with: {py} -m collection export-bot-kit")
|
||||
return rc
|
||||
|
||||
@@ -169,18 +181,7 @@ def cycle(update_main, bots, deliver_to=None, community=False, force=False):
|
||||
built = all(path(src).exists() for src in KIT.values())
|
||||
changed = force or not built or _fingerprint() != before
|
||||
if changed:
|
||||
if shutil.which("node"):
|
||||
_step("route graph", ["node", "analysis/network/build-graph.js"])
|
||||
_step("route model (a few minutes)", [py, "planner/build_policy.py"])
|
||||
_step("experiment plan", [py, "planner/build_experiments.py"])
|
||||
_step("what the runs show about the Black", [py, "analysis/black/evidence.py"])
|
||||
_step("screen tree", [py, "analysis/tree/build_tree.py"])
|
||||
try:
|
||||
import scipy # noqa: F401
|
||||
_step("statistics", [py, "analysis/stats/site_stats.py"])
|
||||
except ImportError:
|
||||
print("\n(scipy is not installed: data/public/stats.json is not rebuilt; the bot does not use it)")
|
||||
_step("runs, generated files and metadata", [py, "-m", "collection", "build"])
|
||||
rebuild()
|
||||
else:
|
||||
print("\nNo new runs: the route model and the plan are unchanged.")
|
||||
now = _headline()
|
||||
|
||||
@@ -109,6 +109,7 @@ def main(argv=None):
|
||||
fg.add_argument("args", nargs=argparse.REMAINDER)
|
||||
k = sub.add_parser("export-bot-kit", help="zip policy.json, experiments.json, solver.js and graph.js for the bot")
|
||||
k.add_argument("--out", default="exports")
|
||||
sub.add_parser("rebuild", help="rebuild everything made from the runs: graph, route model, plan, reports, statistics, build")
|
||||
r = sub.add_parser("refresh", help="update every source, then rebuild everything (the daily workflow, locally)")
|
||||
r.add_argument("--bot", action="append", default=[], help="a bot folder or a .zip of its data (repeatable)")
|
||||
c = sub.add_parser("cycle", help="the loop with the bot: import its runs, refit, re-plan, deliver (safe on a timer)")
|
||||
@@ -129,6 +130,9 @@ def main(argv=None):
|
||||
from .etl.handoff import export_bot_kit
|
||||
print(f"wrote {export_bot_kit(a.out)}")
|
||||
return 0
|
||||
if a.cmd == "rebuild":
|
||||
from .etl.handoff import rebuild
|
||||
return rebuild()
|
||||
if a.cmd == "refresh":
|
||||
from .etl.handoff import refresh
|
||||
return refresh(main, a.bot)
|
||||
|
||||
Reference in New Issue
Block a user