spinn_front_end_common.interface.ds package

Module contents

class spinn_front_end_common.interface.ds.DataRowReader(data)[source]

Bases: spinn_storage_handlers.abstract_classes.abstract_data_reader.AbstractDataReader, spinn_storage_handlers.abstract_classes.abstract_context_manager.AbstractContextManager

close()[source]

Does Nothing

read(n_bytes=None)[source]

Read some bytes of data from the underlying storage. Will block until some bytes are available, but might not return the full n_bytes. The size of the returned array indicates how many bytes were read.

Parameters:n_bytes (int) – The number of bytes to read; if unspecified, read all remaining bytes
Returns:The data that was read
Return type:bytearray
Raises:IOError – If an error occurs reading from the underlying storage
tell()[source]

Returns the position of the file cursor.

Returns:Position of the file cursor
Return type:int
class spinn_front_end_common.interface.ds.DataRowWriter(x, y, p, targets)[source]

Bases: spinn_storage_handlers.abstract_classes.abstract_data_writer.AbstractDataWriter, spinn_storage_handlers.abstract_classes.abstract_context_manager.AbstractContextManager

close()[source]

Closes the writer if not already closed.

write(data)[source]

Write some bytes of data to the underlying storage. Does not return until all the bytes have been written.

Parameters:data (bytearray or bytes) – The data to write
Returns:Nothing is returned
Return type:None
Raises:IOError – If an error occurs writing to the underlying storage
class spinn_front_end_common.interface.ds.DataSpecificationTargets(machine, report_folder, init=None, clear=True)[source]

Bases: _abcoll.MutableMapping

Parameters:
  • machine (Machine) –
  • report_folder (str) –
create_data_spec(x, y, p)[source]
get_app_id(x, y, p)[source]

Gets the app_id set for this core

Parameters:
  • x – core x
  • y – core y
  • p – core p
Return type:

int

get_database()[source]

Expose the database so it can be shared

Return type:DsAbstractDatabase
items() → list of D's (key, value) pairs, as 2-tuples[source]
iteritems()

D.items() -> list of D’s (key, value) pairs, as 2-tuples

keys()[source]

Yields the keys.

As the more typical call is iteritems this makes use of that

Return type:iterable(tuple(int,int,int))
mark_system_cores(core_subsets)[source]
n_targets()

TEMP implementation

Returns:
set_app_id(app_id)[source]

Sets the same app_id for all rows that have DS content

Parameters:app_id (int) – value to set
write_data_spec(x, y, p, ds)[source]
class spinn_front_end_common.interface.ds.DsAbstractDatabase[source]

Bases: object

Interface supported by all database implementations that store data specifications.

clear_ds()[source]

Clear all saved data specification data

clear_write_info()[source]

Clears the provenance for all rows

close()[source]

Signals that the database can be closed and will not be reused.

Note

Once this is called any other method in this API is allowed to raise any kind of exception.

ds_get_app_id(x, y, p)[source]

Gets the app_id set for this core

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Return type:

int

ds_iteritems()[source]

Yields the keys and values for the DS data

Returns:Yields the (x, y, p) and saved ds pairs
Return type:iterable(tuple(tuple(int, int, int), bytearray))
ds_mark_as_system(core_list)[source]

Flags a list of processors as running system binaries.

Parameters:core_list (iterable(tuple(int,int,int))) – list of (core x, core y, core p)
ds_n_cores()[source]

Returns the number for cores there is a ds saved for

Return type:int
ds_set_app_id(app_id)[source]

Sets the same app_id for all rows that have ds content

Parameters:app_id (int) – value to set
get_ds(x, y, p)[source]

Retrieves the data spec as byte code for this core.

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Returns:

data spec as byte code

Return type:

bytearray

get_write_info(x, y, p)[source]

Gets the provenance returned by the Data Spec executor

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Return type:

DataWritten

info_iteritems()[source]

Yields the keys and values for the Info data. Note that a DB transaction may be held while this iterator is processing.

Returns:Yields the (x, y, p) and DataWritten
Return type:iterable(tuple(tuple(int, int, int), DataWritten))
info_n_cores()[source]

Returns the number for cores there is a info saved for.

Return type:int
save_ds(core_x, core_y, core_p, ds)[source]
Parameters:
  • core_x (int) – x of the core ds applies to
  • core_y (int) – y of the core ds applies to
  • p (int) – p of the core ds applies to
  • ds (bytearray) – the data spec as byte code
set_write_info(x, y, p, info)[source]

Sets the provenance returned by the Data Spec executor.

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
  • info (DataWritten) – DataWritten