Skip to content

Commit

Permalink
Some better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed May 22, 2024
1 parent 347c1a9 commit 9302af4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _check_write_block(self) -> None:

if self._size < length:
raise DataSpecException(
f"Region size is {self._size} "
f"Region {self._region_num} size is {self._size} "
f"so unable to write {length} bytes")
if length % 4 != 0:
raise NotImplementedError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@

import struct
import time
import logging
from spinn_utilities.progress_bar import ProgressBar
from spinn_utilities.log import FormatAdapter
from spinnman.messages.scp.enums import Signal
from spinnman.model.enums import CPUState, ExecutableType
from spinn_front_end_common.data import FecDataView
from spinn_front_end_common.utilities.exceptions import (
ExecutableFailedToStopException)

logger = FormatAdapter(logging.getLogger(__name__))

_ONE_WORD = struct.Struct("<I")


Expand Down Expand Up @@ -54,6 +58,11 @@ def application_finisher() -> None:
app_id, CPUState.WATCHDOG)

if processors_rte > 0 or processors_watchdogged > 0:
cpu_infos = txrx.get_cpu_infos(
all_core_subsets,
[CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG], True)
logger.error(cpu_infos.get_status_string())

raise ExecutableFailedToStopException(
f"{processors_rte + processors_watchdogged} of "
f"{total_processors} processors went into an error state "
Expand Down
8 changes: 8 additions & 0 deletions spinn_front_end_common/utilities/database/database_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def create_atom_to_event_id_mapping(
# This could happen if there are no LPGs
if machine_vertices is None:
return
key_vertices = dict()
for (m_vertex, partition_id) in machine_vertices:
atom_keys: Iterable[Tuple[int, int]] = ()
if isinstance(m_vertex.app_vertex, HasCustomAtomKeyMap):
Expand All @@ -256,6 +257,13 @@ def create_atom_to_event_id_mapping(
keys = get_keys(r_info.key, vertex_slice)
start = vertex_slice.lo_atom
atom_keys = [(i, k) for i, k in enumerate(keys, start)]
for _atom, key in atom_keys:
if key in key_vertices:
raise KeyError(
f"Key {key} cannot be assigned to {m_vertex} "
f"because it is already assigned to "
f"{key_vertices[key]}")
key_vertices[key] = m_vertex
m_vertex_id = self.__vertex_to_id[m_vertex]
self.executemany(
"""
Expand Down

0 comments on commit 9302af4

Please sign in to comment.