Fix: anchor drain task flows in Perfetto - #1723
Conversation
Give the submit -> drain -> Scheduler View/Worker View task path an explicit dependency attachment in Perfetto by routing drain-dispatched tasks through the owning scheduler's drain_prepare slice. Keep ordinary dispatch flows unchanged and deduplicate submit-side arrows for subtasks sharing one preparation batch.
📝 WalkthroughWalkthroughThe swimlane converter now assigns trace IDs to ChangesDrain preparation flow binding
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Completion
participant Scheduler
participant Worker
participant SchedulerView
participant Orchestrator
Completion->>Scheduler: route to drain_prepare when present
Scheduler->>Worker: bind preparation and destination events
Scheduler->>SchedulerView: bind preparation and destination events
Orchestrator->>Scheduler: submit unique preparation flow
Scheduler-->>Orchestrator: return bound preparation completion event
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@simpler_setup/tools/swimlane_converter.py`:
- Around line 2524-2526: Update the binding logic around task_to_event_id and
flow_f["bind_id"] so worker_event_id is assigned whenever it is not None,
without requiring source_event_id. Preserve the existing task/core lookup and
avoid changing source-event handling.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ffe720ce-19ba-43a1-be6c-04d2ad541316
📒 Files selected for processing (1)
simpler_setup/tools/swimlane_converter.py
| worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"])) | ||
| if source_event_id is not None and worker_event_id is not None: | ||
| flow_f["bind_id"] = worker_event_id |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Restore Worker View binding for direct dispatch flows.
Line 2525 requires source_event_id before it binds worker_event_id. Ordinary dispatch flows have no source_event_id, so they now lose the Worker View endpoint binding even when the destination event exists. Bind worker_event_id independently.
Proposed fix
- if source_event_id is not None and worker_event_id is not None:
+ if worker_event_id is not None:
flow_f["bind_id"] = worker_event_id📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"])) | |
| if source_event_id is not None and worker_event_id is not None: | |
| flow_f["bind_id"] = worker_event_id | |
| worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"])) | |
| if worker_event_id is not None: | |
| flow_f["bind_id"] = worker_event_id |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@simpler_setup/tools/swimlane_converter.py` around lines 2524 - 2526, Update
the binding logic around task_to_event_id and flow_f["bind_id"] so
worker_event_id is assigned whenever it is not None, without requiring
source_event_id. Preserve the existing task/core lookup and avoid changing
source-event handling.
Give the submit -> drain -> Scheduler View/Worker View task path an explicit dependency attachment in Perfetto by routing drain-dispatched tasks through the owning scheduler's drain_prepare slice.
Keep ordinary dispatch flows unchanged and deduplicate submit-side arrows for subtasks sharing one preparation batch.