Refactor rate-run orchestration with Prefect - #491
Draft
alxsmith wants to merge 34 commits into
Draft
Conversation
Enables the Prefect pipeline to pass output paths between tasks without S3 scans. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Replaces Justfile shell orchestration with precalc and calibrated tasks, compact YAML config loading, and path derivation from tariff naming conventions. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace _write_log (wrote to ~/rdp_run_logs/) with _log_provenance which creates a Prefect markdown artifact visible in the UI per task run. Also fix undefined outputs_base variable in derive_settings. Co-authored-by: Cursor <cursoragent@cursor.com>
Tags (batch, utility, scenario, commit) propagate to all tasks and are filterable in the Prefect UI. Removes the per-task markdown artifact and unused datetime import. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the scenario 'type' field with a single 'quartet' selector (single_rate, multi_rate_collapsed, multi_rate_preserved) that derives the per-stage rate modes and tariff_promotion policy. Unify the two evaluators into one quartet_evaluator that always runs both stages; route the calibrated stage through the promote_subgroup_tariff seam so it always consumes stage-1 *_calibrated.json outputs. resolve_subgroups now also generates the calibrated-stage maps (keyed by _calibrated stems, which CAIRO matches to tariff file stems). Add promote_subgroup for multi_rate_collapsed and update the RIE/BGE pipeline YAMLs to the quartet field. Co-authored-by: Cursor <cursoragent@cursor.com>
Update the Prefect pipeline context doc to the quartet-kind model: vocabulary, the three-kind table, the tariff_promotion seam (promote_subgroup_tariff), the unified quartet_evaluator running both stages, and calibrated-stage map generation. Note the multi_rate_preserved RR caveat under Deferred. Co-authored-by: Cursor <cursoragent@cursor.com>
Centralizes PipelineConfig/ScenarioConfig dataclasses, YAML loading, and tariff stem derivation so quartets resolve paths from config instead of hardcoded names. Co-authored-by: Cursor <cursoragent@cursor.com>
Encode both allocations in the scenario name, add tariff_base and promote, drop source/multi_rate, and use structure base for copy. Co-authored-by: Cursor <cursoragent@cursor.com>
Match BGE: tariff_base, promote, allocation-encoded scenario name, derived multi_rate path, and structure base instead of source. Co-authored-by: Cursor <cursoragent@cursor.com>
generate_scenarios_yaml expands pipeline_bge.yaml into the per-run YAML format that run_scenario.py consumes, keyed by canonical run name. Replaces derive_settings and manual scenario YAML authoring. Also adds validate_preflight_inputs for checking MC paths, ResStock, RR YAMLs, gas maps, and single-rate tariff JSONs before any run. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
alxsmith
commented
Jul 28, 2026
| total_delivery_and_supply_rr = base_rr.get( | ||
| "total_delivery_and_supply_revenue_requirement" | ||
| ) | ||
| customer_count = base_rr.get("test_year_customer_count") |
Contributor
Author
There was a problem hiding this comment.
this is bad. flag for generalizing
alxsmith
commented
Jul 28, 2026
| "total_delivery_and_supply_revenue_requirement" | ||
| ) | ||
| customer_count = base_rr.get("test_year_customer_count") | ||
| kwh_scale_factor = base_rr.get("resstock_kwh_scale_factor") |
Contributor
Author
There was a problem hiding this comment.
same here. needs upstream cleaning
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Redesign the Prefect pipeline from scratch around a generic quartet-based orchestration model. The new pipeline replaces the old 1868-line run_pipeline.py with three focused modules (~1800 lines total) that scale cleanly across scenarios, utilities, and tariff structures.
Key changes:
Reviewer focus
Non-obvious implementation details