hbp_nrp_simserver.server.simulation_server_instance module

class hbp_nrp_simserver.server.simulation_server_instance.SimulationServerInstance(lifecycle: hbp_nrp_commons.simulation_lifecycle.SimulationLifecycle, sim_id: int, sim_dir: str, main_script_path: str, exp_config_path: str)[source]

Bases: object

The class that encapsulates the execution of simulation script in a simulation server and manages its execution in a separate process

MAX_STOP_TIMEOUT: float = 30.0
initialize() → None[source]

Initialize the simulation server:

Run simulation_server.py in a subprocess, spawning a thread that monitors its execution. The stdout of the child process is redirected to a file named simulation_{self.sim_id}.log

property is_running

Returns whether the simulation process is running or not

Returns

True if the simulation process is running, False otherwise.

shutdown() → None[source]

Shuts down this simulation.