Skip to content

Commit

Permalink
Merge 7bc695d into 1e4bed6
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Jun 13, 2019
2 parents 1e4bed6 + 7bc695d commit f373121
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions spinn_machine/machine_factory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from .no_wrap_machine import NoWrapMachine
from .horizontal_wrap_machine import HorizontalWrapMachine
from .vertical_wrap_machine import VerticalWrapMachine
Expand All @@ -9,6 +10,8 @@
from spinn_machine import (Chip, Router)
from .exceptions import SpinnMachineException

logger = logging.getLogger(__name__)

BAD_MSG = "Your machine has {} at {} on board {} which will cause " \
"algorithms to fail. " \
"Please report this to spinnakerusers@googlegroups.com "
Expand Down Expand Up @@ -126,34 +129,41 @@ def machine_repair(original, repair_machine=False):
dead_chips = set()
dead_links = set()
for xy in original.unreachable_incoming_chips():
chip = original.get_chip_at(xy[0], xy[1])
error_xy = original.get_local_xy(chip)
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
msg = BAD_MSG.format(
"unreachable incoming chips", error_xy, ethernet.ip_address)
if repair_machine:
dead_chips.add(xy)
logger.warn(msg)
else:
chip = original.get_chip_at(xy[0], xy[1])
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
raise SpinnMachineException(
BAD_MSG.format(
"unreachable incoming chips", xy, ethernet.ip_address))
raise SpinnMachineException(msg)
for xy in original.unreachable_outgoing_chips():
chip = original.get_chip_at(xy[0], xy[1])
error_xy = original.get_local_xy(chip)
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
msg = BAD_MSG.format(
"unreachable outgoing chips", error_xy, ethernet.ip_address)
if repair_machine:
dead_chips.add(xy)
logger.warn(msg)
else:
chip = original.get_chip_at(xy[0], xy[1])
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
raise SpinnMachineException(
BAD_MSG.format(
"unreachable outcoming chips", xy, ethernet.ip_address))
raise SpinnMachineException(msg)
for xyd in original.one_way_links():
chip = original.get_chip_at(xyd[0], xyd[1])
x, y = original.get_local_xy(chip)
error_xyd = (x, y, xyd[2])
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
msg = BAD_MSG.format("One way links", error_xyd, ethernet.ip_address)
if repair_machine:
dead_links.add(xyd)
logger.warn(msg)
else:
chip = original.get_chip_at(xyd[0], xyd[1])
ethernet = original.get_chip_at(
chip.nearest_ethernet_x, chip.nearest_ethernet_y)
raise SpinnMachineException(
BAD_MSG.format("One way links", xyd, ethernet.ip_address))
raise SpinnMachineException(msg)
if len(dead_chips) == 0 and len(dead_links) == 0:
return original
new_machine = _machine_ignore(original, dead_chips, dead_links)
Expand Down

0 comments on commit f373121

Please sign in to comment.