Add /jobs endpoint to monitor routers and improve service status handling in dashboard
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 16s
CLI Tests / test-cli (push) Failing after 11s
Cross-Node Transaction Testing / transaction-test (push) Successful in 3s
Deploy to Testnet / deploy-testnet (push) Successful in 1m8s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Node Stress Testing / stress-test (push) Successful in 3s
Node Failover Simulation / failover-test (push) Successful in 2s
Production Tests / Production Integration Tests (push) Successful in 17s
Python Tests / test-python (push) Failing after 1m5s
Security Scanning / security-scan (push) Successful in 27s

- Add /jobs endpoint to both agent-coordinator and coordinator-api monitor routers
- Add get_jobs function returning empty list for history and metrics commands
- Update dashboard command to handle both string and dict formats for service status
- Initialize campaigns file when empty in addition to when missing
This commit is contained in:
aitbc
2026-05-08 13:06:19 +02:00
parent d13b27479e
commit 5502d2533a
3 changed files with 18 additions and 2 deletions

View File

@@ -46,3 +46,9 @@ async def get_miners():
async def get_history_dashboard():
"""Get historical dashboard data."""
return []
@router.get("/jobs", response_model=List[Dict])
async def get_jobs():
"""Get jobs list for history and metrics commands."""
return []

View File

@@ -46,3 +46,9 @@ async def get_miners():
async def get_history_dashboard():
"""Get historical dashboard data."""
return []
@router.get("/jobs", response_model=List[Dict])
async def get_jobs():
"""Get jobs list for history and metrics commands."""
return []

View File

@@ -64,7 +64,11 @@ def dashboard(ctx, refresh: int, duration: int):
console.print(f" Services: {len(services)}")
for service_name, service_data in services.items():
status = service_data.get("status", "unknown")
# Handle both string ("online") and dict ({"status": "online"}) formats
if isinstance(service_data, dict):
status = service_data.get("status", "unknown")
else:
status = service_data if service_data else "unknown"
console.print(f" {service_name}: {status}")
# Metrics summary
@@ -374,7 +378,7 @@ CAMPAIGNS_DIR = Path.home() / ".aitbc" / "campaigns"
def _ensure_campaigns():
CAMPAIGNS_DIR.mkdir(parents=True, exist_ok=True)
campaigns_file = CAMPAIGNS_DIR / "campaigns.json"
if not campaigns_file.exists():
if not campaigns_file.exists() or campaigns_file.stat().st_size == 0:
# Seed with default campaigns
default = {"campaigns": [
{