feat(conductor): Add worker tracking and abort event dictionaries to ConductorEngine
This commit is contained in:
@@ -89,6 +89,7 @@ class ConductorEngine:
|
|||||||
self.pool = WorkerPool(max_workers=max_workers)
|
self.pool = WorkerPool(max_workers=max_workers)
|
||||||
self._workers_lock = threading.Lock()
|
self._workers_lock = threading.Lock()
|
||||||
self._active_workers: dict[str, threading.Thread] = {}
|
self._active_workers: dict[str, threading.Thread] = {}
|
||||||
|
self._abort_events: dict[str, threading.Event] = {}
|
||||||
self._tier_usage_lock = threading.Lock()
|
self._tier_usage_lock = threading.Lock()
|
||||||
|
|
||||||
def update_usage(self, tier: str, input_tokens: int, output_tokens: int) -> None:
|
def update_usage(self, tier: str, input_tokens: int, output_tokens: int) -> None:
|
||||||
|
|||||||
19
tests/test_conductor_engine_abort.py
Normal file
19
tests/test_conductor_engine_abort.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import pytest
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
from src.multi_agent_conductor import ConductorEngine
|
||||||
|
from src.models import Track
|
||||||
|
|
||||||
|
def test_conductor_engine_initializes_empty_worker_and_abort_dicts() -> None:
|
||||||
|
"""
|
||||||
|
Test that ConductorEngine correctly initializes _active_workers and _abort_events as empty dictionaries.
|
||||||
|
"""
|
||||||
|
# Mock the track object
|
||||||
|
mock_track = MagicMock(spec=Track)
|
||||||
|
mock_track.tickets = []
|
||||||
|
|
||||||
|
# Initialize ConductorEngine
|
||||||
|
engine = ConductorEngine(track=mock_track)
|
||||||
|
|
||||||
|
# Verify _active_workers and _abort_events are empty dictionaries
|
||||||
|
assert engine._active_workers == {}
|
||||||
|
assert engine._abort_events == {}
|
||||||
Reference in New Issue
Block a user