Skip to content

Commit

Permalink
Expose execute and others as full methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Sep 21, 2023
1 parent 976f649 commit 1ae4337
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def redundant_packet_count_report():

def _create_views():
with ProvenanceWriter() as db:
db._execute(REDUNDANCY_BY_CORE)
db._execute(REDUNDANCY_SUMMARY)
db.execute(REDUNDANCY_BY_CORE)
db.execute(REDUNDANCY_SUMMARY)


def _write_report(output):
Expand Down
38 changes: 19 additions & 19 deletions spynnaker/pyNN/utilities/neo_buffer_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def write_segment_metadata(self):
The database must be writable for this to work!
"""
# t_stop intentionally left None to show no run data
self._execute(
self.execute(
"""
INSERT INTO segment
(simulation_time_step_ms, segment_number, rec_datetime,
Expand All @@ -120,7 +120,7 @@ def write_t_stop(self):
The database must be writable for this to work!
"""
t_stop = SpynnakerDataView.get_current_run_time_ms()
self._execute(
self.execute(
"""
UPDATE segment
SET t_stop = ?
Expand All @@ -137,7 +137,7 @@ def __get_segment_info(self):
~spinn_front_end_common.utilities.exceptions.ConfigurationException:
If the recording metadata not setup correctly
"""
for row in self._execute(
for row in self.execute(
"""
SELECT segment_number, rec_datetime, t_stop, dt, simulator
FROM segment
Expand Down Expand Up @@ -165,7 +165,7 @@ def __get_simulation_time_step_ms(self):
:rtype: float
:return: The timestep
"""
for row in self._execute(
for row in self.execute(
"""
SELECT simulation_time_step_ms
FROM segment
Expand Down Expand Up @@ -193,21 +193,21 @@ def __get_population_id(self, pop_label, population):
the population to record for
:return: The ID
"""
for row in self._execute(
for row in self.execute(
"""
SELECT pop_id FROM population
WHERE label = ?
LIMIT 1
""", (pop_label,)):
return row["pop_id"]
self._execute(
self.execute(
"""
INSERT INTO population
(label, first_id, description, pop_size)
VALUES (?, ?, ?, ?)
""", (pop_label, population.first_id, population.describe(),
population.size))
return self._lastrowid
return self.lastrowid

def __get_recording_id(
self, pop_label, variable, population,
Expand Down Expand Up @@ -241,7 +241,7 @@ def __get_recording_id(
:param int n_colour_bits:
:return: The ID
"""
for row in self._execute(
for row in self.execute(
"""
SELECT rec_id FROM recording_view
WHERE label = ? AND variable = ?
Expand All @@ -253,15 +253,15 @@ def __get_recording_id(
data_type_name = data_type.name
else:
data_type_name = None
self._execute(
self.execute(
"""
INSERT INTO recording
(pop_id, variable, data_type, buffered_type, t_start,
sampling_interval_ms, units, n_colour_bits)
VALUES (?, ?, ?, ?, 0, ?, ?, ?)
""", (pop_id, variable, data_type_name, str(buffered_type),
sampling_interval_ms, units, n_colour_bits))
return self._lastrowid
return self.lastrowid

def __get_population_metadata(self, pop_label):
"""
Expand All @@ -280,7 +280,7 @@ def __get_population_metadata(self, pop_label):
~spinn_front_end_common.utilities.exceptions.ConfigurationException:
If the recording metadata not setup correctly
"""
for row in self._execute(
for row in self.execute(
"""
SELECT pop_size, first_id, description
FROM population
Expand Down Expand Up @@ -324,7 +324,7 @@ def get_recording_populations(self):
:rtype: list(str)
"""
results = []
for row in self._execute(
for row in self.execute(
"""
SELECT label
FROM population
Expand Down Expand Up @@ -389,7 +389,7 @@ def __get_recording_variables(self, pop_label):
:rtype: list(str)
"""
results = []
for row in self._execute(
for row in self.execute(
"""
SELECT variable
FROM recording_view
Expand Down Expand Up @@ -445,7 +445,7 @@ def __get_recording_metadeta(self, pop_label, variable):
~spinn_front_end_common.utilities.exceptions.ConfigurationException:
If the recording metadata not setup correctly
"""
for row in self._execute(
for row in self.execute(
"""
SELECT rec_id, data_type, buffered_type, t_start,
sampling_interval_ms, pop_size, units, n_colour_bits
Expand Down Expand Up @@ -476,7 +476,7 @@ def __get_region_metadata(self, rec_id):
region_id, neurons, vertex_slice, selective_recording, base_key
:rtype: iterable(tuple(int, ~numpy.ndarray, Slice, bool, int))
"""
rows = list(self._execute(
rows = list(self.execute(
"""
SELECT region_id, recording_neurons_st, vertex_slice, base_key
FROM region_metadata
Expand Down Expand Up @@ -1324,7 +1324,7 @@ def clear_data(self, pop_label, variables):
t_start = SpynnakerDataView.get_current_run_time_ms()
variables = self.__clean_variables(variables, pop_label)
for variable in variables:
self._execute(
self.execute(
"""
UPDATE recording SET
t_start = ?
Expand All @@ -1333,7 +1333,7 @@ def clear_data(self, pop_label, variables):
FROM recording_view
WHERE label = ? AND variable = ?)
""", (t_start, pop_label, variable))
self._execute(
self.execute(
"""
UPDATE region SET
content = CAST('' AS BLOB), content_len = 0,
Expand All @@ -1343,7 +1343,7 @@ def clear_data(self, pop_label, variables):
FROM region_metadata NATURAL JOIN recording_view
WHERE label = ? AND variable = ?)
""", (pop_label, variable))
self._execute(
self.execute(
"""
DELETE FROM region_extra
WHERE region_id in
Expand Down Expand Up @@ -1402,7 +1402,7 @@ def __write_metadata(self, population, variable):
base_key = vertex.get_virtual_key()
else:
base_key = None
self._execute(
self.execute(
"""
INSERT INTO region_metadata
(rec_id, region_id, recording_neurons_st,
Expand Down

0 comments on commit 1ae4337

Please sign in to comment.