hbp_nrp_simserver.server.nrp_script_runner module

This module contains the start script of a state machine process

class hbp_nrp_simserver.server.nrp_script_runner.NRPScriptRunner(sim_settings: hbp_nrp_simserver.server.SimulationSettings, exp_config: types.SimpleNamespace, publish_error: Callable[[], None])[source]

Bases: object

Executes nrp-core experiments “main script” as a python script.

The script execution can be started, paused and stopped. The script is expected to use the injected ‘nrp’ handler (an instance of NrpCoreWrapper) and call its run_loop method until a NRPSimulationTimeout is raised.

initialize() → None[source]
Initialize the script runner:
  • read the script

  • initialize the (wrapped) nrp_core client

Any initialization error from nrp_core client will be raised.

It gets called by whatever component is controlling the simulation (i.e. a SimulationServerLifecycle)

Raises
  • IOError – when the script can’t be read from the file system

  • SyntaxError – when the script code has such an error

property is_initialized
pause() → None[source]

Pauses the script execution.

property real_time
shutdown() → None[source]
property simulation_time
property simulation_time_remaining
start(completed_callback: Callable[[], None] = <function NRPScriptRunner.<lambda>>) → None[source]

Starts the script.

Parameters

completed_callback – A callable to be called when the main script has terminated its execution.

stop() → None[source]

Stops the script execution.