add replay command: reconstruct the observed schedule#3
Merged
Conversation
`analyze` predicts a theoretical lower bound on wall-clock from the DAG's critical path. `replay` does the complementary thing: reads the observed schedule out of run_results.json (thread_id + per-phase timing) and joins against manifest.json's parent_map to report: - per-thread utilization (busy vs. idle, events executed) - observed critical path, walked backwards from the last-completing node by picking, at each step, the parent whose completion time was closest to this node's start - top idle gaps, each attributed to the parent node the thread was waiting on (or flagged as scheduler overhead if all parents were already done) CLI: `dbt-dag-opt replay --manifest ... --run-results ...` with `text` (default) and `json` formats. Same file/cloud input modes as `analyze`. Tests: synthetic 4-node 2-thread fixture with known expected chain + integration fixture at tests/fixtures/dbt_dugout/ (real 57-node Snowflake run) smoke-tested through CLI. Suite: 42 passed (+13 replay tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Summary
dbt-dag-opt replay, a complementary command toanalyze. Whereanalyzeis theoretical (critical path from DAG topology),replayreads the observed schedule out ofrun_results.json— every result carries athread_idand per-phasetimingwith start/end timestamps — joined againstmanifest.json'sparent_mapto attribute blocking.text(default, rich tables) andjsonoutput formats. Same file/cloud input modes asanalyze, same env var token.Stacking
This PR targets
pypi-v0.1.0(#1) because the package scaffolding lives there. Merge order: #1 first, rebase ontomain, then merge this.Test plan
pytest— 42 passed (13 new for replay; 29 pre-existing)ruff check .+mypy src— cleandbt-dag-opt replay --manifest tests/fixtures/dbt_dugout/manifest.json --run-results tests/fixtures/dbt_dugout/run_results.json— renders summary, thread utilization, critical path, and attributed idle gaps against a real 57-node 4-thread Snowflake run.conftest.pyasserts exact expected critical path, thread utilization, and idle-gap attribution.🤖 Generated with Claude Code