Skip to content

Commit

Permalink
Merge pull request #1507 from SpiNNakerManchester/not_read_only_if_clear
Browse files Browse the repository at this point in the history
on a clear the database can not be read only
  • Loading branch information
Christian-B authored Nov 14, 2024
2 parents ab71f9e + bd29d72 commit e68575e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion spynnaker/pyNN/models/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ def __append_previous_segment(
~spinn_front_end_common.utilities.exceptions.ConfigurationException:
If the recording not setup correctly
"""
with NeoBufferDatabase.segement_db(segment_number) as db:
with NeoBufferDatabase.segement_db(
segment_number, read_only=not clear) as db:
if block is None:
block = db.get_empty_block(
self.__population.label, annotations)
Expand Down
5 changes: 3 additions & 2 deletions spynnaker/pyNN/utilities/neo_buffer_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ def __init__(self, database_file: Optional[str] = None,
segment_cache[segment] = database_file

@classmethod
def segement_db(cls, segment_number: int) -> NeoBufferDatabase:
def segement_db(cls, segment_number: int,
read_only: Optional[bool] = None) -> NeoBufferDatabase:
"""
Retrieves a NeoBufferDatabase for this segment.
"""
database_file = segment_cache[segment_number]
return NeoBufferDatabase(database_file)
return NeoBufferDatabase(database_file, read_only)

def write_segment_metadata(self) -> None:
"""
Expand Down

0 comments on commit e68575e

Please sign in to comment.