hbp_nrp_simserver.server package

This is package contains the Simulation server. It runs user-defined python scripts that use an nrp_client.NRPCore.

A simulation server can be managed by an instance of SimulationServerInstance and once initialized it sends, on MQTT topics, information about its status (/status) and, on error, a message describing such error (/runtime_error).

The runtime state of the server is controlled via an instance of SimulationLifecycle that reacts to state changes initiated by the user via the REST API exposed by hbp_nrp_backend.server. Besides those, state changes initiated by the Simulation server are the ones that depend on the simulation being run, i.e. ‘completed’ and ‘failed’.

class hbp_nrp_simserver.server.ServerProcessExitCodes(value)[source]

Bases: enum.IntEnum

Exit error codes for simulation_server.py

INITIALIZATION_ERROR = 1
NO_ERROR = 0
RUNNING_ERROR = 3
SHUTDOWN_ERROR = 2
class hbp_nrp_simserver.server.SimulationSettings(sim_id: str, sim_dir: str, exp_config_file: str, main_script_file: str)[source]

Bases: object

sim_id: the ID of the simulation sim_dir: the directory containing the simulation files exp_config_file: the experiment configuration file name (e.g. experiment_configuration.json) main_script_file: the simulation’s main script file name (e.g. main_script.py)

exp_config_file: str
main_script_file: str
sim_dir: str
sim_id: str
hbp_nrp_simserver.server.TOPIC_ERROR(sim_id)
hbp_nrp_simserver.server.TOPIC_LIFECYCLE(sim_id)
hbp_nrp_simserver.server.TOPIC_STATUS(sim_id)