Implements the Coordinator class with main orchestration loop: - Async loop architecture with configurable poll interval - process_queue() method gets next ready issue and spawns agent (stub) - Graceful shutdown handling with stop() method - Error handling that allows loop to continue after failures - Logging for all actions (start, stop, processing, errors) - Integration with QueueManager from #159 - Active agent tracking for future agent management Configuration settings added: - COORDINATOR_POLL_INTERVAL (default: 5.0s) - COORDINATOR_MAX_CONCURRENT_AGENTS (default: 10) - COORDINATOR_ENABLED (default: true) Tests: 27 new tests covering all acceptance criteria Coverage: 92% overall (100% for coordinator.py) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
996 B
Python
43 lines
996 B
Python
"""Configuration management for mosaic-coordinator."""
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=False,
|
|
extra="ignore",
|
|
)
|
|
|
|
# Gitea Configuration
|
|
gitea_webhook_secret: str
|
|
gitea_url: str = "https://git.mosaicstack.dev"
|
|
|
|
# Anthropic API
|
|
anthropic_api_key: str
|
|
|
|
# Server Configuration
|
|
host: str = "0.0.0.0"
|
|
port: int = 8000
|
|
|
|
# Logging
|
|
log_level: str = "info"
|
|
|
|
# Coordinator Configuration
|
|
coordinator_poll_interval: float = 5.0
|
|
coordinator_max_concurrent_agents: int = 10
|
|
coordinator_enabled: bool = True
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
"""Get settings instance (lazy loaded)."""
|
|
return Settings() # type: ignore[call-arg]
|
|
|
|
|
|
# Global settings instance
|
|
settings = get_settings()
|