Hermes
Simulation Orchestration Platform for Aerospace
Loading...
Searching...
No Matches
hermes.core.process.ProcessManager Class Reference
Collaboration diagram for hermes.core.process.ProcessManager:

Public Member Functions

None __init__ (self, HermesConfig config)
HermesConfig config (self)
SharedMemoryManager|None shm (self)
dict[str, ModuleProcessmodules (self)
dict[str, InprocModuleinproc_modules (self)
None initialize (self)
None load_all (self)
None stage_all (self)
None step_all (self, float timeout=30.0)
None reset_all (self)
None update_time (self, int frame, int time_ns)
None terminate_all (self)
ModuleProcess|None get_module (self, str name)
InprocModule|None get_inproc_module (self, str name)
InprocModuleProtocol|None get_module_instance (self, str name)
ProcessManager __enter__ (self)
None __exit__ (self, *object args)

Protected Attributes

HermesConfig _config = config
SharedMemoryManager|None _shm = None
FrameBarrier|None _barrier = None
dict _modules = {}
dict _inproc_modules = {}
str _shm_name = f"/hermes_{os.getpid()}"
str _barrier_name = f"/hermes_barrier_{os.getpid()}"

Detailed Description

Coordinates all module processes.

Manages the lifecycle of multiple module processes, including
shared memory setup, synchronization, and orderly shutdown.
Supports both subprocess (process/script) and in-process (inproc) modules.

Constructor & Destructor Documentation

◆ __init__()

None hermes.core.process.ProcessManager.__init__ ( self,
HermesConfig config )
Initialize process manager.

Args:
    config: Hermes configuration

Member Function Documentation

◆ __enter__()

ProcessManager hermes.core.process.ProcessManager.__enter__ ( self)
Context manager entry - initialize resources.

◆ __exit__()

None hermes.core.process.ProcessManager.__exit__ ( self,
*object args )
Context manager exit - clean up resources.

◆ config()

HermesConfig hermes.core.process.ProcessManager.config ( self)
Hermes configuration.

◆ get_inproc_module()

InprocModule | None hermes.core.process.ProcessManager.get_inproc_module ( self,
str name )
Get an in-process module by name.

◆ get_module()

ModuleProcess | None hermes.core.process.ProcessManager.get_module ( self,
str name )
Get a subprocess module by name.

◆ get_module_instance()

InprocModuleProtocol | None hermes.core.process.ProcessManager.get_module_instance ( self,
str name )
Get module instance by name for in-process modules.

◆ initialize()

None hermes.core.process.ProcessManager.initialize ( self)
Create shared resources and load all modules.

This sets up:
1. Shared memory segment with all signals
2. Synchronization barrier (for subprocess modules)
3. Module processes / in-process modules

If any step fails, previously created resources are cleaned up.

◆ inproc_modules()

dict[str, InprocModule] hermes.core.process.ProcessManager.inproc_modules ( self)
Loaded in-process modules.

◆ load_all()

None hermes.core.process.ProcessManager.load_all ( self)
Start all subprocess module processes.

◆ modules()

dict[str, ModuleProcess] hermes.core.process.ProcessManager.modules ( self)
Loaded subprocess modules.

◆ reset_all()

None hermes.core.process.ProcessManager.reset_all ( self)
Reset all modules to initial state and re-stage them.

Calls reset() on each inproc module, which restores initial
conditions and resets signal values. Modules are then re-staged
so they are ready for execution.

Raises:
    ProcessError: If subprocess modules are present, since they
        cannot be reset without pipe IPC (not yet implemented).

◆ shm()

SharedMemoryManager | None hermes.core.process.ProcessManager.shm ( self)
Shared memory manager.

◆ stage_all()

None hermes.core.process.ProcessManager.stage_all ( self)
Stage all modules for execution.

◆ step_all()

None hermes.core.process.ProcessManager.step_all ( self,
float timeout = 30.0 )
Execute one simulation frame across all modules.

For subprocess modules, uses barrier synchronization.
For inproc modules, calls step() directly in execution order.

Args:
    timeout: Maximum seconds to wait for subprocess modules

Raises:
    ProcessError: If not initialized
    TimeoutError: If subprocess modules don't complete within timeout

◆ terminate_all()

None hermes.core.process.ProcessManager.terminate_all ( self)
Gracefully terminate all modules.

◆ update_time()

None hermes.core.process.ProcessManager.update_time ( self,
int frame,
int time_ns )
Update frame number and simulation time in shared memory.

Args:
    frame: Current frame number
    time_ns: Current simulation time in nanoseconds

Member Data Documentation

◆ _barrier

FrameBarrier | None hermes.core.process.ProcessManager._barrier = None
protected

◆ _barrier_name

str hermes.core.process.ProcessManager._barrier_name = f"/hermes_barrier_{os.getpid()}"
protected

◆ _config

HermesConfig hermes.core.process.ProcessManager._config = config
protected

◆ _inproc_modules

dict hermes.core.process.ProcessManager._inproc_modules = {}
protected

◆ _modules

dict hermes.core.process.ProcessManager._modules = {}
protected

◆ _shm

hermes.core.process.ProcessManager._shm = None
protected

◆ _shm_name

str hermes.core.process.ProcessManager._shm_name = f"/hermes_{os.getpid()}"
protected

The documentation for this class was generated from the following file: