-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
🧠 Summary
Refactor DynamicPool and SwitchLock to support adaptive execution behavior through configurable bias, backpressure, and priority-based modes. This will enable DynamicPool to operate not just as a standard thread pool but as a burst-oriented, agent-aware control unit.
❗ Problem
Current limitations in DynamicPool:
- Threads idle even as work queues up — dead task risk.
- No backpressure when saturation occurs.
- No priority override — all tasks treated equally.
- SwitchLock assumes static flow — no pressure awareness.
These weaknesses limit the system’s usability for high-throughput or agentic workloads.
🎯 Goals
- Add execution modes: standard, bias-controlled, and burst.
- Support backpressure behaviors:
- wait
- defer
- reject
- Enable priority overrides that bypass normal scheduling.
- Introduce a new SwitchQueue object to internalize queue logic + control flow.
🛠️ Proposed Implementation
✅ Add Execution Modes
Example:
DynamicPool with configurable execution behavior:
- min_workers: 4
- max_workers: 12
- bias_enabled: True
- bias_pressure: 8
- backpressure_mode: wait (or reject, defer)
- allow_priority_override: True
✅ Core Additions
-
SwitchQueue
Combines:- Internal queue logic
- SwitchLock integration
- Pressure tracking
- Override path
-
Bias + Pressure Enforcement
- Configurable pressure thresholds
- Allows burst behavior with fallback to standard execution
-
Thread-safe capacity awareness
- Real-time tracking of idle threads
- Dynamic wait/reject logic
-
Graceful degradation + recovery
- Pools adapt over time
- Override/work re-queue path
🤖 Long-Term Vision
- DynamicPool becomes a burst-control node, not just executor.
- Threads become agentic, aware of pool pressure/state.
- Tasks negotiate for execution rights based on system conditions.
- Orchestrator can dynamically reconfigure pools at runtime.
🧪 Milestones
- Define SwitchQueue (queue + SwitchLock controller)
- Integrate SwitchQueue into DynamicPoolContainer
- Add config hooks for backpressure and priority
- Implement enforcement logic in SwitchQueue / DynamicPool
- Create edge-case test suite: idle drain, burst saturation, override behavior
- Document all execution modes
Let the pool evolve. Let threads choose. Let the system breathe.
Metadata
Metadata
Assignees
Labels
No labels