Spaces:
Sleeping
Sleeping
Update modules/orchestrator.py
Browse files- modules/orchestrator.py +7 -8
modules/orchestrator.py
CHANGED
|
@@ -8,6 +8,7 @@ import signal
|
|
| 8 |
import time
|
| 9 |
import psutil
|
| 10 |
import threading
|
|
|
|
| 11 |
from abc import ABC, abstractmethod
|
| 12 |
from datetime import datetime
|
| 13 |
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
|
|
@@ -83,8 +84,6 @@ def monitor_system_resources(func: Callable):
|
|
| 83 |
return result
|
| 84 |
return wrapper
|
| 85 |
|
| 86 |
-
import functools # Re-importing inside for safety if used as standalone
|
| 87 |
-
|
| 88 |
# ==========================================
|
| 89 |
# 5. CORE INTERFACES (CONTRACTS)
|
| 90 |
# ==========================================
|
|
@@ -516,8 +515,9 @@ if __name__ == "__main__":
|
|
| 516 |
pass
|
| 517 |
except Exception as e:
|
| 518 |
print(f"FATAL ERROR: {e}")
|
|
|
|
| 519 |
# ==========================================
|
| 520 |
-
# REGISTER MODULE FUNCTION
|
| 521 |
# ==========================================
|
| 522 |
def register_module(app, client, username):
|
| 523 |
"""Register orchestrator module with FastAPI app"""
|
|
@@ -531,15 +531,14 @@ def register_module(app, client, username):
|
|
| 531 |
"module": "orchestrator",
|
| 532 |
"status": "active",
|
| 533 |
"version": "2.0.1-Stable",
|
| 534 |
-
"endpoints": ["/orchestrator/health", "/system/task", "/system/status"]
|
| 535 |
}
|
| 536 |
|
| 537 |
-
# Register existing endpoints
|
| 538 |
-
from .orchestrator import get_system_diagnostics
|
| 539 |
-
|
| 540 |
@router.get("/orchestrator/diagnostics")
|
| 541 |
async def module_diagnostics():
|
|
|
|
|
|
|
| 542 |
return await get_system_diagnostics()
|
| 543 |
|
| 544 |
app.include_router(router)
|
| 545 |
-
print("✅ Orchestrator module registered with FastAPI")
|
|
|
|
| 8 |
import time
|
| 9 |
import psutil
|
| 10 |
import threading
|
| 11 |
+
import functools
|
| 12 |
from abc import ABC, abstractmethod
|
| 13 |
from datetime import datetime
|
| 14 |
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
|
|
|
|
| 84 |
return result
|
| 85 |
return wrapper
|
| 86 |
|
|
|
|
|
|
|
| 87 |
# ==========================================
|
| 88 |
# 5. CORE INTERFACES (CONTRACTS)
|
| 89 |
# ==========================================
|
|
|
|
| 515 |
pass
|
| 516 |
except Exception as e:
|
| 517 |
print(f"FATAL ERROR: {e}")
|
| 518 |
+
|
| 519 |
# ==========================================
|
| 520 |
+
# 12. REGISTER MODULE FUNCTION (FIXED LINE 539)
|
| 521 |
# ==========================================
|
| 522 |
def register_module(app, client, username):
|
| 523 |
"""Register orchestrator module with FastAPI app"""
|
|
|
|
| 531 |
"module": "orchestrator",
|
| 532 |
"status": "active",
|
| 533 |
"version": "2.0.1-Stable",
|
| 534 |
+
"endpoints": ["/orchestrator/health", "/orchestrator/diagnostics", "/system/task", "/system/status"]
|
| 535 |
}
|
| 536 |
|
|
|
|
|
|
|
|
|
|
| 537 |
@router.get("/orchestrator/diagnostics")
|
| 538 |
async def module_diagnostics():
|
| 539 |
+
"""Diagnostics endpoint - FIXED: No circular import"""
|
| 540 |
+
# DIRECTLY CALL THE FUNCTION DEFINED ABOVE (line ~526)
|
| 541 |
return await get_system_diagnostics()
|
| 542 |
|
| 543 |
app.include_router(router)
|
| 544 |
+
print("✅ Orchestrator module registered with FastAPI")
|