Load existing state, or create one from the optimization plan.
()
| 185 | |
| 186 | |
| 187 | def get_or_create_state() -> dict: |
| 188 | """Load existing state, or create one from the optimization plan.""" |
| 189 | state = load_state() |
| 190 | if state is not None: |
| 191 | return state |
| 192 | |
| 193 | plan = load_plan() |
| 194 | if plan is None: |
| 195 | print("ERROR: No optimization_plan.json found. Run extract.py first.") |
| 196 | sys.exit(1) |
| 197 | |
| 198 | print("Initializing orchestration state from optimization_plan.json ...") |
| 199 | state = _initialize_state_from_plan(plan) |
| 200 | save_state(state) |
| 201 | return state |
| 202 | |
| 203 | |
| 204 | # --------------------------------------------------------------------------- |
no test coverage detected