Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on a clear the database can not be read only #1507

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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