spinn_front_end_common.utilities.database package¶
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
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.
Note
The machine description database reader can only be used while the registered database callbacks are running.
Note
This class coordinates with the
NotificationProtocol
class without routing messages via SpiNNaker.Parameters: - start_resume_callback_function (callable) – 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 (callable(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 will not be needed further, and the return response will be sent.
-
class
spinn_front_end_common.utilities.database.
DatabaseReader
(database_path)[source]¶ Bases:
spinn_front_end_common.utilities.sqlite_db.SQLiteDB
A reader for the database.
Parameters: database_path (str) – The path to the database -
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 Return type: dict(int, int)
-
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 or None
-
get_ip_address
(x, y)[source]¶ Get an IP address to contact a chip.
Parameters: Returns: The IP address of the Ethernet to use to contact the chip
Return type:
-
get_job
()[source]¶ Get the job described in the database. If no job exists, direct connection to boards should be used.
Returns: Job handle, if one exists. None
otherwise.Return type: SpallocJob
-
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(int, 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, board address, tag, chip_x, chip_y) Return type: tuple(str, int, bool, str, int, int, int)
-
-
class
spinn_front_end_common.utilities.database.
DatabaseWriter
[source]¶ Bases:
spinn_front_end_common.utilities.sqlite_db.SQLiteDB
The interface for the database system for main front ends. Any special tables needed from a front end should be done by subclasses of this interface.
-
add_application_vertices
()[source]¶ Stores the main application graph description (vertices, edges).
-
add_lpg_mapping
()[source]¶ Add mapping from machine vertex to LPG machine vertex.
Returns: A list of (source vertex, partition id) Return type: list(MachineVertex, str)
-
add_system_params
(runtime)[source]¶ Write system params into the database.
Parameters: runtime (int) – the amount of time the application is to run for
Adds the tags into the database.
-
static
auto_detect_database
()[source]¶ Auto detects if there is a need to activate the database system.
Returns: whether the database is needed for the application Return type: bool
-