commit 61313daee45dacfa7dedb48195ceecfaa26a6b31 Author: Codex Date: Sat Apr 11 06:16:02 2026 -0400 Initial renunney scaffold diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..74a7abe --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +.DS_Store +__pycache__/ +.pytest_cache/ +*.pyc +*.pyo +*.pyd +.Python +.venv/ +venv/ +build/ +dist/ +*.egg-info/ + +runs/state/* +!runs/state/.gitkeep +runs/results/* +!runs/results/.gitkeep +runs/scratch/* +!runs/scratch/.gitkeep + +*.sqlite +*.sqlite3 +*.log +*.tmp +*.swp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8ec5b52 --- /dev/null +++ b/Makefile @@ -0,0 +1,90 @@ +PYTHON := python3 +REPO_ROOT := $(abspath .) +LEGACY_ROOT := $(REPO_ROOT)/../collaborations/to_ptbc/evc/cost_of_substitution +ORCH := $(LEGACY_ROOT)/python/run_orchestration.py + +DB := $(REPO_ROOT)/runs/state/cos-orch.sqlite +RESULT_ROOT := $(REPO_ROOT)/runs/results +SCRATCH_ROOT := $(REPO_ROOT)/runs/scratch + +FIG1_M005 := $(LEGACY_ROOT)/examples/track1_figure1_paper_M_0_05.json +FIG1_M025 := $(LEGACY_ROOT)/examples/track1_figure1_paper_M_0_25.json +FIG1_M05 := $(LEGACY_ROOT)/examples/track1_figure1_paper_M_0_5.json +FIG1_M10 := $(LEGACY_ROOT)/examples/track1_figure1_paper_M_1_0.json +FIG1_M100 := $(LEGACY_ROOT)/examples/track1_figure1_paper_M_10_0.json + +.PHONY: help init doctor list-jobs run-one run-loop run-loop-one collate-figure1 \ + submit-figure1-m005 submit-figure1-m025 submit-figure1-m05 submit-figure1-m10 submit-figure1-m100 \ + submit-all-figure1 status results-tree + +help: + @echo "Targets:" + @echo " init Create run directories and initialize the SQLite registry" + @echo " doctor Show key paths and verify legacy orchestration entrypoint" + @echo " list-jobs List jobs in the local registry" + @echo " run-one Claim and run one queued job" + @echo " run-loop Run worker loop until queue empty" + @echo " run-loop-one Run exactly one queued job through the worker loop" + @echo " collate-figure1 Collate completed Track 1 Figure 1 jobs" + @echo " submit-figure1-m005 Submit Figure 1 paper-scale jobs for M=0.05" + @echo " submit-figure1-m025 Submit Figure 1 paper-scale jobs for M=0.25" + @echo " submit-figure1-m05 Submit Figure 1 paper-scale jobs for M=0.5" + @echo " submit-figure1-m10 Submit Figure 1 paper-scale jobs for M=1.0" + @echo " submit-figure1-m100 Submit Figure 1 paper-scale jobs for M=10.0" + @echo " submit-all-figure1 Submit all paper-scale Figure 1 treatments" + @echo " status Show job status and current result tree" + @echo " results-tree List the current result files" + +init: + mkdir -p $(REPO_ROOT)/runs/state $(REPO_ROOT)/runs/results $(REPO_ROOT)/runs/scratch + $(PYTHON) $(ORCH) init-db --db $(DB) + +doctor: + @echo "REPO_ROOT=$(REPO_ROOT)" + @echo "LEGACY_ROOT=$(LEGACY_ROOT)" + @echo "DB=$(DB)" + @echo "RESULT_ROOT=$(RESULT_ROOT)" + @echo "SCRATCH_ROOT=$(SCRATCH_ROOT)" + test -f $(ORCH) + +list-jobs: + $(PYTHON) $(ORCH) list --db $(DB) + +run-one: + $(PYTHON) $(ORCH) run-one --db $(DB) --result-root $(RESULT_ROOT) --scratch-root $(SCRATCH_ROOT) + +run-loop: + $(PYTHON) $(ORCH) run-loop --db $(DB) --result-root $(RESULT_ROOT) --scratch-root $(SCRATCH_ROOT) + +run-loop-one: + $(PYTHON) $(ORCH) run-loop --db $(DB) --result-root $(RESULT_ROOT) --scratch-root $(SCRATCH_ROOT) --max-jobs 1 + +collate-figure1: + $(PYTHON) $(ORCH) collate-figure1 --db $(DB) --output $(RESULT_ROOT)/figure1-collated.json + +submit-figure1-m005: + $(PYTHON) $(ORCH) submit-figure1 --db $(DB) --config $(FIG1_M005) --job-prefix fig1-m005 --created-by make + +submit-figure1-m025: + $(PYTHON) $(ORCH) submit-figure1 --db $(DB) --config $(FIG1_M025) --job-prefix fig1-m025 --created-by make + +submit-figure1-m05: + $(PYTHON) $(ORCH) submit-figure1 --db $(DB) --config $(FIG1_M05) --job-prefix fig1-m05 --created-by make + +submit-figure1-m10: + $(PYTHON) $(ORCH) submit-figure1 --db $(DB) --config $(FIG1_M10) --job-prefix fig1-m10 --created-by make + +submit-figure1-m100: + $(PYTHON) $(ORCH) submit-figure1 --db $(DB) --config $(FIG1_M100) --job-prefix fig1-m100 --created-by make + +submit-all-figure1: submit-figure1-m005 submit-figure1-m025 submit-figure1-m05 submit-figure1-m10 submit-figure1-m100 + +results-tree: + find $(RESULT_ROOT) -maxdepth 4 -type f | sort + +status: + @echo "Jobs:" + $(PYTHON) $(ORCH) list --db $(DB) + @echo + @echo "Results:" + find $(RESULT_ROOT) -maxdepth 4 -type f | sort || true diff --git a/README.md b/README.md new file mode 100644 index 0000000..91fb642 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# renunney + +Clean working repository for: + +- faithful replication of Leonard Nunney's 2003 cost-of-substitution results, +- orchestration of distributed sweep runs, +- later migration to a faster Rust-backed worker. + +## Current Scope + +This repository is the clean operational wrapper around the current work in: + +- [`../collaborations/to_ptbc/evc/cost_of_substitution`](/mnt/CIFS/pengolodh/Docs/Projects/collaborations/to_ptbc/evc/cost_of_substitution) + +The current orchestration and Track 1 simulation code still live there. +`renunney` provides: + +- a clean git repo, +- a stable working directory layout, +- a Makefile for common tasks, +- migration notes for pulling code into this repo in stages. + +## Layout + +- `docs/` + - project and migration notes +- `config/` + - configuration templates and examples +- `runs/state/` + - SQLite registries and persistent orchestration state +- `runs/results/` + - result artifacts collected by orchestration +- `runs/scratch/` + - local worker scratch and cache files +- `src/renunney/` + - future in-repo Python package and migration target + +## Start + +Initialize the local run directories and SQLite registry: + +```bash +make init +``` + +Submit a paper-scale Figure 1 treatment: + +```bash +make submit-figure1-m10 +``` + +Run one worker loop locally: + +```bash +make run-loop +``` + +Collate completed Figure 1 jobs: + +```bash +make collate-figure1 +``` + +## Status + +The active simulation/orchestration implementation remains in the older +`cost_of_substitution` directory for now. This repo is the clean shell for +running, organizing, and gradually migrating that work. diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..99788a9 --- /dev/null +++ b/config/README.md @@ -0,0 +1,10 @@ +# Config + +Configuration templates and future environment-specific settings for: + +- master registry paths +- result roots +- scratch roots +- host-specific worker defaults + +This directory is intentionally small for now. diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md new file mode 100644 index 0000000..1f775ce --- /dev/null +++ b/docs/MIGRATION.md @@ -0,0 +1,38 @@ +# Migration + +## Goal + +Move the current cost-of-substitution implementation into `renunney` in staged, +low-risk steps. + +## Current State + +Operational code still lives in: + +- [`../../collaborations/to_ptbc/evc/cost_of_substitution`](/mnt/CIFS/pengolodh/Docs/Projects/collaborations/to_ptbc/evc/cost_of_substitution) + +`renunney` currently acts as: + +- a clean git repository, +- a run-control wrapper, +- a stable place for deployment and orchestration commands, +- the eventual destination for migrated code. + +## Recommended Migration Order + +1. Keep orchestration running from the legacy path until real multi-host runs are stable. +2. Migrate the orchestration modules first: + - `python/orchestration.py` + - `python/run_orchestration.py` +3. Migrate Track 1 runner and API next: + - `python/run_track1.py` + - `python/track1_api.py` +4. Migrate the Track 1 simulation core after the runner path is stable: + - `python/track1_reference.py` + - `python/track1_threshold.py` + - `python/track1_analysis.py` +5. Migrate docs and example configs last, after path references are updated. + +## Constraint + +Do not break the ability to run current Figure 1 jobs while migrating code. diff --git a/docs/WORKFLOW.md b/docs/WORKFLOW.md new file mode 100644 index 0000000..2f310d3 --- /dev/null +++ b/docs/WORKFLOW.md @@ -0,0 +1,44 @@ +# Workflow + +## Daily Use + +Initialize local state: + +```bash +make init +``` + +Check paths: + +```bash +make doctor +``` + +Submit a Figure 1 treatment: + +```bash +make submit-figure1-m10 +``` + +Run jobs: + +```bash +make run-loop +``` + +Collate completed results: + +```bash +make collate-figure1 +``` + +Inspect current status: + +```bash +make status +``` + +## Current Assumption + +The Makefile drives the orchestration code in the legacy +`cost_of_substitution` directory until that code is migrated here. diff --git a/runs/results/.gitkeep b/runs/results/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/runs/results/.gitkeep @@ -0,0 +1 @@ + diff --git a/runs/scratch/.gitkeep b/runs/scratch/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/runs/scratch/.gitkeep @@ -0,0 +1 @@ + diff --git a/runs/state/.gitkeep b/runs/state/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/runs/state/.gitkeep @@ -0,0 +1 @@ + diff --git a/src/renunney/__init__.py b/src/renunney/__init__.py new file mode 100644 index 0000000..62671d6 --- /dev/null +++ b/src/renunney/__init__.py @@ -0,0 +1 @@ +"""renunney package placeholder."""