refactor: deprecate DAG-level maxActiveRuns and enhance queue stability#1598
Conversation
maxActiveRuns field and enhance queue stabilitymaxActiveRuns and enhance queue stability
📝 WalkthroughWalkthroughDeprecates DAG.MaxActiveRuns and updates OpenAPI/schema docs. Local (DAG-based) queues are treated as FIFO with maxConcurrency = 1. Queue processor removed DAG-driven concurrency, added atomic in-flight tracking and goroutine dispatch; builder emits deprecation warnings. Tests updated to assert FIFO/local-queue behavior. Changes
Sequence Diagram(s)sequenceDiagram
Client->>Scheduler: Enqueue item (QueuedItemData)
Scheduler->>QueueProcessor: ProcessQueueItems()
Note right of QueueProcessor: compute free = maxConc - alive - inflight
QueueProcessor->>Queue: dequeue item
Queue->>Queue: incInflight()
Queue->>WorkerPool: dispatch DAG run (goroutine)
WorkerPool->>DAGExecutor: run DAG
DAGExecutor-->>WorkerPool: run complete
WorkerPool->>Queue: decInflight()
Queue->>QueueProcessor: notify completion (monitorStartup/backoff logic)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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
🤖 Fix all issues with AI agents
In `@internal/service/scheduler/queue_processor.go`:
- Around line 312-315: The in-flight key uses only queueName + runID which can
collide across different DAGs that reuse run IDs; update the key construction to
incorporate the DAG identifier from the run object (e.g., use runRef.DAGID or
runRef.Spec.DAGName / other canonical DAG identifier available on runRef) so the
key becomes queueName + "/" + dagIdentifier + "/" + runID (or similar), and
replace usages of inFlightKey accordingly to ensure uniqueness across DAGs.
🧹 Nitpick comments (4)
internal/service/frontend/api/v2/queues.go (1)
65-68: Consider removing the unused DAG preload now that queue creation ignores it.The DAG is still read once per group, but its value isn’t used after
getOrCreateQueuestopped taking a DAG. If there’s no side-effect needed, dropping that read will save store I/O.internal/core/spec/builder_test.go (1)
3309-3390: Consider table‑driving the deprecation warning cases to reduce duplication.
The subtests share the same structure (YAML + expected warning). A small table would make additions simpler. As per coding guidelines, prefer table‑driven cases.api/v2/api.gen.go (1)
485-487: Add an explicit deprecation reason in the OpenAPI schema.
The generated “Deprecated: … no x-deprecated-reason was set” isn’t very user-facing. Consider addingx-deprecated-reasonin the schema so these comments become meaningful for bothDAGandDAGDetails.Also applies to: 534-536
internal/intg/queue/queue_test.go (1)
27-41: Clarify: DoesTestGlobalConcurrencystill use the deprecatedmaxActiveRunsintentionally?The
maxActiveRuns: 1on line 31 is set but the test uses a global queue withmaxConcurrency=3. SincemaxActiveRunsis deprecated for local queues, consider whether this field should be removed from this test spec to avoid confusion, or add a comment clarifying it's intentionally ignored here.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1598 +/- ##
==========================================
+ Coverage 59.99% 60.05% +0.06%
==========================================
Files 288 288
Lines 32660 32636 -24
==========================================
+ Hits 19594 19601 +7
+ Misses 11312 11281 -31
Partials 1754 1754
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Deprecations
maxActiveRunsfor local DAG-based queues; configure concurrency via a global queue (queuefield).Bug Fixes
Tests & Docs
✏️ Tip: You can customize this high-level summary in your review settings.