Frontend Enhancements: - Complete React TypeScript frontend with modern UI components - Distributed workflows management interface with real-time updates - Socket.IO integration for live agent status monitoring - Agent management dashboard with cluster visualization - Project management interface with metrics and task tracking - Responsive design with proper error handling and loading states Backend Infrastructure: - Distributed coordinator for multi-agent workflow orchestration - Cluster management API with comprehensive agent operations - Enhanced database models for agents and projects - Project service for filesystem-based project discovery - Performance monitoring and metrics collection - Comprehensive API documentation and error handling Documentation: - Complete distributed development guide (README_DISTRIBUTED.md) - Comprehensive development report with architecture insights - System configuration templates and deployment guides The platform now provides a complete web interface for managing the distributed AI cluster with real-time monitoring, workflow orchestration, and agent coordination capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
2.5 KiB
Python
69 lines
2.5 KiB
Python
"""
|
|
Cluster API endpoints for monitoring cluster nodes and workflows.
|
|
"""
|
|
from fastapi import APIRouter, HTTPException
|
|
from typing import Dict, Any, List, Optional
|
|
from ..services.cluster_service import ClusterService
|
|
|
|
router = APIRouter()
|
|
cluster_service = ClusterService()
|
|
|
|
@router.get("/cluster/overview")
|
|
async def get_cluster_overview() -> Dict[str, Any]:
|
|
"""Get overview of entire cluster status."""
|
|
try:
|
|
return cluster_service.get_cluster_overview()
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/nodes")
|
|
async def get_cluster_nodes() -> Dict[str, Any]:
|
|
"""Get status of all cluster nodes."""
|
|
try:
|
|
overview = cluster_service.get_cluster_overview()
|
|
return {"nodes": overview["nodes"]}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/nodes/{node_id}")
|
|
async def get_node_details(node_id: str) -> Dict[str, Any]:
|
|
"""Get detailed information about a specific node."""
|
|
try:
|
|
node_details = cluster_service.get_node_details(node_id)
|
|
if not node_details:
|
|
raise HTTPException(status_code=404, detail="Node not found")
|
|
return node_details
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/models")
|
|
async def get_available_models() -> Dict[str, List[Dict[str, Any]]]:
|
|
"""Get all available models across all nodes."""
|
|
try:
|
|
return cluster_service.get_available_models()
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/workflows")
|
|
async def get_n8n_workflows() -> List[Dict[str, Any]]:
|
|
"""Get n8n workflows from the cluster."""
|
|
try:
|
|
return cluster_service.get_n8n_workflows()
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/metrics")
|
|
async def get_cluster_metrics() -> Dict[str, Any]:
|
|
"""Get aggregated cluster metrics."""
|
|
try:
|
|
return cluster_service.get_cluster_metrics()
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
@router.get("/cluster/executions")
|
|
async def get_workflow_executions(limit: int = 10) -> List[Dict[str, Any]]:
|
|
"""Get recent workflow executions from n8n."""
|
|
try:
|
|
return cluster_service.get_workflow_executions(limit)
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e)) |