petter2025 commited on
Commit
c9eaa2d
·
verified ·
1 Parent(s): c6cea2c

Update demo/orchestrator.py

Browse files
Files changed (1) hide show
  1. demo/orchestrator.py +14 -5
demo/orchestrator.py CHANGED
@@ -1,4 +1,4 @@
1
- # demo/orchestrator.py - FIXED VERSION
2
  from __future__ import annotations
3
 
4
  import logging
@@ -17,8 +17,9 @@ try:
17
  calculate_pattern_confidence
18
  )
19
  MOCK_ARF_AVAILABLE = True
20
- except ImportError:
21
- logger.warning("Mock ARF functions not available")
 
22
  MOCK_ARF_AVAILABLE = False
23
 
24
 
@@ -29,6 +30,7 @@ class DemoOrchestrator:
29
 
30
  def __init__(self, enable_streamlit: bool = False):
31
  self.enable_streamlit = enable_streamlit
 
32
 
33
  async def analyze_incident(self, scenario_name: str, scenario_data: Dict[str, Any]) -> Dict[str, Any]:
34
  """
@@ -38,6 +40,7 @@ class DemoOrchestrator:
38
  logger.info(f"Analyzing incident: {scenario_name}")
39
 
40
  if not MOCK_ARF_AVAILABLE:
 
41
  return {
42
  "status": "error",
43
  "message": "Mock ARF functions not available",
@@ -46,19 +49,22 @@ class DemoOrchestrator:
46
 
47
  try:
48
  # Step 1: Detection Agent
 
49
  detection_result = simulate_arf_analysis(scenario_data)
50
 
51
  # Step 2: Recall Agent
 
52
  similar_incidents = run_rag_similarity_search(scenario_data)
53
 
54
  # Step 3: Decision Agent
 
55
  confidence = calculate_pattern_confidence(scenario_data, similar_incidents)
56
  healing_intent = create_mock_healing_intent(scenario_data, similar_incidents, confidence)
57
 
58
  # Simulate processing time
59
  await asyncio.sleep(0.5)
60
 
61
- return {
62
  "status": "success",
63
  "scenario": scenario_name,
64
  "detection": detection_result,
@@ -68,8 +74,11 @@ class DemoOrchestrator:
68
  "processing_time_ms": 450
69
  }
70
 
 
 
 
71
  except Exception as e:
72
- logger.error(f"Error analyzing incident: {e}")
73
  return {
74
  "status": "error",
75
  "message": str(e),
 
1
+ # demo/orchestrator.py - COMPLETE FIXED VERSION
2
  from __future__ import annotations
3
 
4
  import logging
 
17
  calculate_pattern_confidence
18
  )
19
  MOCK_ARF_AVAILABLE = True
20
+ logger.info("Mock ARF functions available")
21
+ except ImportError as e:
22
+ logger.warning(f"Mock ARF functions not available: {e}")
23
  MOCK_ARF_AVAILABLE = False
24
 
25
 
 
30
 
31
  def __init__(self, enable_streamlit: bool = False):
32
  self.enable_streamlit = enable_streamlit
33
+ logger.info("DemoOrchestrator initialized")
34
 
35
  async def analyze_incident(self, scenario_name: str, scenario_data: Dict[str, Any]) -> Dict[str, Any]:
36
  """
 
40
  logger.info(f"Analyzing incident: {scenario_name}")
41
 
42
  if not MOCK_ARF_AVAILABLE:
43
+ logger.error("Mock ARF functions not available")
44
  return {
45
  "status": "error",
46
  "message": "Mock ARF functions not available",
 
49
 
50
  try:
51
  # Step 1: Detection Agent
52
+ logger.debug("Running detection agent...")
53
  detection_result = simulate_arf_analysis(scenario_data)
54
 
55
  # Step 2: Recall Agent
56
+ logger.debug("Running recall agent...")
57
  similar_incidents = run_rag_similarity_search(scenario_data)
58
 
59
  # Step 3: Decision Agent
60
+ logger.debug("Running decision agent...")
61
  confidence = calculate_pattern_confidence(scenario_data, similar_incidents)
62
  healing_intent = create_mock_healing_intent(scenario_data, similar_incidents, confidence)
63
 
64
  # Simulate processing time
65
  await asyncio.sleep(0.5)
66
 
67
+ result = {
68
  "status": "success",
69
  "scenario": scenario_name,
70
  "detection": detection_result,
 
74
  "processing_time_ms": 450
75
  }
76
 
77
+ logger.info(f"Analysis complete for {scenario_name}")
78
+ return result
79
+
80
  except Exception as e:
81
+ logger.error(f"Error analyzing incident: {e}", exc_info=True)
82
  return {
83
  "status": "error",
84
  "message": str(e),