spinn_front_end_common.utilities.database package¶
Submodules¶
spinn_front_end_common.utilities.database.database_connection module¶
-
class
spinn_front_end_common.utilities.database.database_connection.
DatabaseConnection
(start_resume_callback_function=None, stop_pause_callback_function=None, local_host=None, local_port=19999)[source]¶ Bases:
spinnman.connections.udp_packet_connections.udp_connection.UDPConnection
,threading.Thread
A connection from the toolchain which will be notified when the database has been written, and can then respond when the database has been read, and further wait for notification that the simulation has started.
Parameters: - start_resume_callback_function (function() -> None) – A function to be called when the start message has been received. This function should not take any parameters or return anything.
- local_host (str) – Optional specification of the local hostname or ip address of the interface to listen on
- local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
-
add_database_callback
(database_callback_function)[source]¶ Add a database callback to be called when the database is ready
Parameters: database_callback_function (function( spynnaker_external_devices.pyNN.connections.database_reader.DatabaseReader
) -> None) – A function to be called when the database message has been received. This function should take a single parameter, which will be a DatabaseReader object. Once the function returns, it will be assumed that the database has been read, and the return response will be sent.
-
run
()[source]¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
spinn_front_end_common.utilities.database.database_reader module¶
-
class
spinn_front_end_common.utilities.database.database_reader.
DatabaseReader
(database_path)[source]¶ Bases:
object
A reader for the database
Parameters: database_path (str) – The path to the database -
cursor
¶ The database cursor. Allows custom SQL queries to be performed.
Return type: sqlite3.Cursor
-
get_atom_id_to_key_mapping
(label)[source]¶ Get a mapping of atom id to event key for a given vertex
Parameters: label (str) – The label of the vertex Returns: dictionary of event keys indexed by atom id
-
get_configuration_parameter_value
(parameter_name)[source]¶ Get the value of a configuration parameter
Parameters: parameter_name (str) – The name of the parameter Returns: The value of the parameter Return type: float
-
get_key_to_atom_id_mapping
(label)[source]¶ Get a mapping of event key to atom id for a given vertex
Parameters: label (str) – The label of the vertex Returns: dictionary of atom ids indexed by event key Return type: dict
-
get_live_input_details
(label)[source]¶ Get the ip address and port where live input should be sent for a given vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port) Return type: (str, int)
-
get_live_output_details
(label, receiver_label)[source]¶ Get the ip address, port and whether the SDP headers are to be stripped from the output from a vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port, strip SDP) Return type: (str, int, bool)
-
get_machine_live_input_details
(label)[source]¶ Get the ip address and port where live input should be sent for a given machine vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port) Return type: (str, int)
-
spinn_front_end_common.utilities.database.database_writer module¶
-
class
spinn_front_end_common.utilities.database.database_writer.
DatabaseWriter
(database_directory)[source]¶ Bases:
object
The interface for the database system for main front ends. Any special tables needed from a front end should be done by sub classes of this interface.
-
add_application_vertices
(application_graph)[source]¶ Parameters: application_graph – Return type: None
-
add_machine_objects
(machine)[source]¶ Store the machine object into the database
Parameters: machine – the machine object. Return type: None
-
add_placements
(placements)[source]¶ Adds the placements objects into the database
Parameters: - placements – the placements object
- machine_graph – the machine graph object
Return type: None
-
add_routing_infos
(routing_infos, machine_graph)[source]¶ Adds the routing information (key masks etc) into the database
Parameters: - routing_infos – the routing information object
- machine_graph – the machine graph object
Return type: None:
-
add_routing_tables
(routing_tables)[source]¶ Adds the routing tables into the database
Parameters: routing_tables – the routing tables object Return type: None
-
add_system_params
(time_scale_factor, machine_time_step, runtime)[source]¶ Write system params into the database
Parameters: - time_scale_factor – the time scale factor used in timing
- machine_time_step – the machine time step used in timing
- runtime – the amount of time the application is to run for
Adds the tags into the database
Parameters: - machine_graph – the machine graph object
- tags – the tags object
Return type: None
-
add_vertices
(machine_graph, graph_mapper, application_graph)[source]¶ Add the machine graph, graph mapper and application graph into the database.
Parameters: - machine_graph – the machine graph object
- graph_mapper – the graph mapper object
- application_graph – the application graph object
Return type: None
-
static
auto_detect_database
(machine_graph)[source]¶ Auto detects if there is a need to activate the database system
Parameters: machine_graph – the machine graph of the application problem space. Returns: a bool which represents if the database is needed
-
create_atom_to_event_id_mapping
(application_graph, machine_graph, routing_infos, graph_mapper)[source]¶ Parameters: - application_graph –
- machine_graph –
- routing_infos –
- graph_mapper –
Return type: None
-
database_path
¶
-
Module contents¶
-
class
spinn_front_end_common.utilities.database.
DatabaseConnection
(start_resume_callback_function=None, stop_pause_callback_function=None, local_host=None, local_port=19999)[source]¶ Bases:
spinnman.connections.udp_packet_connections.udp_connection.UDPConnection
,threading.Thread
A connection from the toolchain which will be notified when the database has been written, and can then respond when the database has been read, and further wait for notification that the simulation has started.
Parameters: - start_resume_callback_function (function() -> None) – A function to be called when the start message has been received. This function should not take any parameters or return anything.
- local_host (str) – Optional specification of the local hostname or ip address of the interface to listen on
- local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
-
add_database_callback
(database_callback_function)[source]¶ Add a database callback to be called when the database is ready
Parameters: database_callback_function (function( spynnaker_external_devices.pyNN.connections.database_reader.DatabaseReader
) -> None) – A function to be called when the database message has been received. This function should take a single parameter, which will be a DatabaseReader object. Once the function returns, it will be assumed that the database has been read, and the return response will be sent.
-
run
()[source]¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
class
spinn_front_end_common.utilities.database.
DatabaseReader
(database_path)[source]¶ Bases:
object
A reader for the database
Parameters: database_path (str) – The path to the database -
cursor
¶ The database cursor. Allows custom SQL queries to be performed.
Return type: sqlite3.Cursor
-
get_atom_id_to_key_mapping
(label)[source]¶ Get a mapping of atom id to event key for a given vertex
Parameters: label (str) – The label of the vertex Returns: dictionary of event keys indexed by atom id
-
get_configuration_parameter_value
(parameter_name)[source]¶ Get the value of a configuration parameter
Parameters: parameter_name (str) – The name of the parameter Returns: The value of the parameter Return type: float
-
get_key_to_atom_id_mapping
(label)[source]¶ Get a mapping of event key to atom id for a given vertex
Parameters: label (str) – The label of the vertex Returns: dictionary of atom ids indexed by event key Return type: dict
-
get_live_input_details
(label)[source]¶ Get the ip address and port where live input should be sent for a given vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port) Return type: (str, int)
-
get_live_output_details
(label, receiver_label)[source]¶ Get the ip address, port and whether the SDP headers are to be stripped from the output from a vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port, strip SDP) Return type: (str, int, bool)
-
get_machine_live_input_details
(label)[source]¶ Get the ip address and port where live input should be sent for a given machine vertex
Parameters: label (str) – The label of the vertex Returns: tuple of (ip address, port) Return type: (str, int)
-
-
class
spinn_front_end_common.utilities.database.
DatabaseWriter
(database_directory)[source]¶ Bases:
object
The interface for the database system for main front ends. Any special tables needed from a front end should be done by sub classes of this interface.
-
add_application_vertices
(application_graph)[source]¶ Parameters: application_graph – Return type: None
-
add_machine_objects
(machine)[source]¶ Store the machine object into the database
Parameters: machine – the machine object. Return type: None
-
add_placements
(placements)[source]¶ Adds the placements objects into the database
Parameters: - placements – the placements object
- machine_graph – the machine graph object
Return type: None
-
add_routing_infos
(routing_infos, machine_graph)[source]¶ Adds the routing information (key masks etc) into the database
Parameters: - routing_infos – the routing information object
- machine_graph – the machine graph object
Return type: None:
-
add_routing_tables
(routing_tables)[source]¶ Adds the routing tables into the database
Parameters: routing_tables – the routing tables object Return type: None
-
add_system_params
(time_scale_factor, machine_time_step, runtime)[source]¶ Write system params into the database
Parameters: - time_scale_factor – the time scale factor used in timing
- machine_time_step – the machine time step used in timing
- runtime – the amount of time the application is to run for
Adds the tags into the database
Parameters: - machine_graph – the machine graph object
- tags – the tags object
Return type: None
-
add_vertices
(machine_graph, graph_mapper, application_graph)[source]¶ Add the machine graph, graph mapper and application graph into the database.
Parameters: - machine_graph – the machine graph object
- graph_mapper – the graph mapper object
- application_graph – the application graph object
Return type: None
-
static
auto_detect_database
(machine_graph)[source]¶ Auto detects if there is a need to activate the database system
Parameters: machine_graph – the machine graph of the application problem space. Returns: a bool which represents if the database is needed
-
create_atom_to_event_id_mapping
(application_graph, machine_graph, routing_infos, graph_mapper)[source]¶ Parameters: - application_graph –
- machine_graph –
- routing_infos –
- graph_mapper –
Return type: None
-
database_path
¶
-