MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / __init__

Method __init__

orchestrator.py:41–68  ·  view source on GitHub ↗

Initialise the orchestrator

(self)

Source from the content-addressed store, hash-verified

39
40class Orchestrator:
41 def __init__(self):
42 """Initialise the orchestrator"""
43 self.shared_data = shared_data
44 self.actions = [] # List of actions to be executed
45 self.standalone_actions = [] # List of standalone actions to be executed
46 self.failed_scans_count = 0 # Count the number of failed scans
47 self.network_scanner = None
48 self.nmap_vuln_scanner = None
49 self.last_vuln_scan_time = datetime.min # Set the last vulnerability scan time to the minimum datetime value
50
51 # Verify critical configuration attributes exist
52 self._verify_config_attributes()
53
54 self.load_actions() # Load all actions from the actions file
55 actions_loaded = [action.__class__.__name__ for action in self.actions + self.standalone_actions] # Get the names of the loaded actions
56 logger.info(f"Actions loaded: {actions_loaded}")
57
58 # CRITICAL: Pi Zero W2 resource management - limit concurrent actions
59 # Running too many actions simultaneously causes memory exhaustion and hangs
60 # REDUCED to 1 to prevent OOM kills during AI + scanning + display updates
61 self.semaphore = threading.Semaphore(1) # Max 1 concurrent action for Pi Zero W2
62
63 # No longer using ThreadPoolExecutor - direct threading is more reliable
64 # and avoids "cannot schedule new futures after interpreter shutdown" errors
65
66 # Default timeout for action execution (in seconds)
67 self.action_timeout = getattr(self.shared_data, 'action_timeout', 300) # 5 minutes default
68 self.vuln_scan_timeout = getattr(self.shared_data, 'vuln_scan_timeout', 1800) # 30 minutes for vuln scans
69
70 def _verify_config_attributes(self):
71 """Verify that all required configuration attributes exist on shared_data."""

Callers

nothing calls this directly

Calls 3

load_actionsMethod · 0.95
infoMethod · 0.80

Tested by

no test coverage detected