-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,31 +24,6 @@ | |
|
||
logger = FormatAdapter(logging.getLogger(__name__)) | ||
|
||
BAD_MSG = ( | ||
"Your machine has {} at {} on board {} which will cause algorithms to " | ||
"fail. Please report this to [email protected] \n\n") | ||
ONE_LINK_SAME_BOARD_MSG = ( | ||
"Link {} from global chip id {}:{} to global chip id {}:{} does not " | ||
"exist, but the opposite does. Both chips live on the same board under " | ||
"ip address {} and are local chip ids {}:{} and {}:{}. " | ||
"Please report this to [email protected] \n\n") | ||
ONE_LINK_DIFFERENT_BOARDS_MSG = ( | ||
"Link {} from global chip id {}:{} to global chip id {}:{} does not " | ||
"exist, but the opposite does. The chips live on different boards. " | ||
"chip {}:{} resides on board with ip address {} with local id {}:{} and " | ||
"chip {}:{} resides on board with ip address {} with local id {}:{}. " | ||
"Please report this to [email protected] \n\n") | ||
ONE_LINK_DEAD_CHIP = ( | ||
"Link {} from global dead chip id {}:{} to global chip id {}:{} does not " | ||
"exist, but the opposite does. chip {}:{} resides on board with ip " | ||
"address {} but as chip {}:{} is dead, we cannot report its ip address. " | ||
"Please report this to [email protected] \n\n") | ||
CHIP_REMOVED_BY_DEAD_PARENT = ( | ||
"The chip {}:{} will fail to receive signals because its parent {}:{} in" | ||
" the signal tree has disappeared from the machine since it was booted. " | ||
"This occurred on board with ip address {} Please report this to " | ||
"[email protected] \n\n") | ||
|
||
|
||
def _machine_ignore( | ||
original: Machine, dead_chips: Collection[XY], | ||
|
@@ -102,7 +77,7 @@ def _machine_ignore( | |
|
||
|
||
def _generate_uni_direction_link_error( | ||
dest_x: int, dest_y: int, src_x: int, src_y: int, back: int, | ||
dest_x: int, dest_y: int, src_x: int, src_y: int, out: int, back: int, | ||
original: Machine) -> str: | ||
# get the chips so we can find ethernet's and local ids | ||
dest_chip = original.get_chip_at(dest_x, dest_y) | ||
|
@@ -112,9 +87,10 @@ def _generate_uni_direction_link_error( | |
|
||
# if the dest chip is dead. Only report src chip ip address. | ||
if dest_chip is None: | ||
return ONE_LINK_DEAD_CHIP.format( | ||
back, dest_x, dest_y, src_x, src_y, src_x, src_y, src_ethernet, | ||
dest_x, dest_y) | ||
return f"Link {out} from {src_chip} to {dest_x}:{dest_y} points to " \ | ||
f"a dead chip. Chip {src_x}:{src_y} resides on board with ip " \ | ||
f"address {src_ethernet}. " \ | ||
f"Please report this to [email protected] \n\n" | ||
|
||
# got working chips, so get the separate ethernet's | ||
dest_ethernet = original[ | ||
|
@@ -127,15 +103,21 @@ def _generate_uni_direction_link_error( | |
# generate bespoke error message based off if they both reside on same | ||
# board. | ||
if src_ethernet == dest_ethernet: | ||
return ONE_LINK_SAME_BOARD_MSG.format( | ||
back, dest_x, dest_y, src_x, src_y, src_ethernet, | ||
local_dest_chip_x, local_dest_chip_y, local_src_chip_x, | ||
local_src_chip_y) | ||
return f"Link {back} from {dest_chip} to {src_chip} does not exist, " \ | ||
f"but the opposite does. Both chips live on the same board " \ | ||
f"under ip address {src_ethernet} and are local chip " \ | ||
f"ids {local_dest_chip_x}:{local_dest_chip_y} and " \ | ||
f"{local_src_chip_x}:{local_src_chip_y}. " \ | ||
f"Please report this to [email protected] \n\n" | ||
else: | ||
return ONE_LINK_DIFFERENT_BOARDS_MSG.format( | ||
back, dest_x, dest_y, src_x, src_y, dest_x, dest_y, dest_ethernet, | ||
local_dest_chip_x, local_dest_chip_y, src_x, src_y, src_ethernet, | ||
local_src_chip_x, local_src_chip_y) | ||
return f"Link {back} from {dest_chip} to {src_chip} does not exist, " \ | ||
f"but the opposite does. The chips live on different boards. " \ | ||
f"chip {dest_x}:{dest_y} resides on board with ip address " \ | ||
f"{dest_ethernet} with local id {local_dest_chip_x}:" \ | ||
f"{local_dest_chip_y} and chip {src_x}:{src_y} resides on " \ | ||
f"board with ip address {src_ethernet} with local id " \ | ||
f"{local_src_chip_x}:{local_src_chip_y}. " \ | ||
f"Please report this to [email protected] \n\n" | ||
|
||
|
||
def machine_repair(original: Machine, removed_chips: Iterable[XY] = ()): | ||
|
@@ -168,8 +150,9 @@ def machine_repair(original: Machine, removed_chips: Iterable[XY] = ()): | |
chip = original[xy[0], xy[1]] | ||
error_xy = original.get_local_xy(chip) | ||
ethernet = original[chip.nearest_ethernet_x, chip.nearest_ethernet_y] | ||
msg = BAD_MSG.format( | ||
"unreachable incoming chips", error_xy, ethernet.ip_address) | ||
msg = f"Your machine has unreachable incoming chips at {error_xy} " \ | ||
f"on board {ethernet} which will cause algorithms to fail. " \ | ||
f"Please report this to [email protected] \n\n" | ||
if repair_machine: | ||
dead_chips.add(xy) | ||
logger.warning(msg) | ||
|
@@ -180,8 +163,9 @@ def machine_repair(original: Machine, removed_chips: Iterable[XY] = ()): | |
chip = original[xy[0], xy[1]] | ||
error_xy = original.get_local_xy(chip) | ||
ethernet = original[chip.nearest_ethernet_x, chip.nearest_ethernet_y] | ||
msg = BAD_MSG.format( | ||
"unreachable outgoing chips", error_xy, ethernet.ip_address) | ||
msg = f"Your machine has unreachable outgoing chips at {error_xy} " \ | ||
f"on board {ethernet} which will cause algorithms to fail. " \ | ||
f"Please report this to [email protected] \n\n" | ||
if repair_machine: | ||
dead_chips.add(xy) | ||
logger.warning(msg) | ||
|
@@ -194,7 +178,7 @@ def machine_repair(original: Machine, removed_chips: Iterable[XY] = ()): | |
dead_links.add((source_x, source_y, out, back)) | ||
else: | ||
uni_direction_link_message = _generate_uni_direction_link_error( | ||
dest_x, dest_y, source_x, source_y, back, original) | ||
dest_x, dest_y, source_x, source_y, out, back, original) | ||
if repair_machine: | ||
dead_links.add((source_x, source_y, out, back)) | ||
logger.warning(uni_direction_link_message) | ||
|
@@ -207,11 +191,15 @@ def machine_repair(original: Machine, removed_chips: Iterable[XY] = ()): | |
parent_x, parent_y = original.xy_over_link( | ||
chip.x, chip.y, chip.parent_link) | ||
if not original.is_chip_at(parent_x, parent_y): | ||
ethernet_chip = original[ | ||
chip.nearest_ethernet_x, chip.nearest_ethernet_y] | ||
msg = CHIP_REMOVED_BY_DEAD_PARENT.format( | ||
chip.x, chip.y, parent_x, parent_y, | ||
ethernet_chip.ip_address) | ||
ethernet = original[chip.nearest_ethernet_x, | ||
chip.nearest_ethernet_y] | ||
msg = f"The source: {Chip} will fail to receive signals " \ | ||
f"because its parent {parent_x}:{parent_y} in the " \ | ||
f"signal tree has disappeared from the machine since " \ | ||
f"it was booted. This occurred on board with " \ | ||
f"ip address {ethernet.ip_address} " \ | ||
f"Please report this to " \ | ||
f"[email protected] \n\n" | ||
if repair_machine: | ||
dead_chips.add((chip.x, chip.y)) | ||
logger.warning(msg) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters