hbp_nrp_backend.rest_server package

This package contains the implementation of the REST server to control experiments

class hbp_nrp_backend.rest_server.ErrorMessages[source]

Bases: object

Definition of error strings

INVALID_STATE_TRANSITION_400 = 'The state transition is invalid'
OPERATION_INVALID_IN_CURRENT_STATE_403 = 'The operation is forbidden while the simulation is in its current state'
SERVER_ERROR_500 = 'The query failed due to an internal server error'
SIMULATIONS_RETRIEVED_200 = 'Simulations retrieved successfully'
SIMULATION_ANOTHER_RUNNING_409 = 'Another simulation is already running on the server'
SIMULATION_CREATED_201 = 'Simulation created successfully'
SIMULATION_NOT_FOUND_404 = 'The simulation with the given ID was not found'
SIMULATION_PERMISSION_401 = 'Insufficient permissions to apply changes. Operation only allowed by simulation owner'
SIMULATION_PERMISSION_401_VIEW = 'Insufficient permissions to see the simulation changes. You can only see the simulations you own or those for which the experiment has been shared with you'
SIMULATION_RETRIEVED_200 = 'Simulation retrieved successfully'
STATE_APPLIED_200 = 'Success. The new state has been correctly applied'
STATE_RETRIEVED_200 = 'Success. The simulation state has been retrieved'
VERSIONS_RETRIEVED_200 = 'Success. Components versions has been retrieved'
class hbp_nrp_backend.rest_server.NRPServicesExtendedApi(app=None, prefix='', default_mediatype='application/json', decorators=None, catch_all_404s=False, serve_challenge_on_401=False, url_part_order='bae', errors=None)[source]

Bases: flask_restful.Api

Extend Flask Restful error handling mechanism so that we can still use original Flask error handlers (defined in __ErrorHandlers.py)

error_router(original_handler, e)[source]

Route the error

Parameters
  • original_handler – Flask handler

  • e – Error

hbp_nrp_backend.rest_server.docstring_parameter(*sub)[source]

Helper functions to include variables in docstrings using the @docstring_parameter decorator

Parameters

sub – List of variables to be included in the docstring.