Skip to content

Commit

Permalink
Merge pull request #1097 from SpiNNakerManchester/no_frames3
Browse files Browse the repository at this point in the history
No frames3
  • Loading branch information
rowleya authored Aug 2, 2023
2 parents 936713a + ec5668a commit ef0e8f2
Showing 1 changed file with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,18 @@ def machine_generator(
return txrx.get_machine_details(), txrx


def _parse_bmp_cabinet_and_frame(bmp_cabinet_and_frame):
def _parse_bmp_cabinet_and_frame(bmp_str):
"""
:param str bmp_cabinet_and_frame:
:rtype: tuple(int or str, int or str, str, str or None)
:param str bmp_str:
:rtype: tuple(str, str or None)
"""
split_string = bmp_cabinet_and_frame.split(";", 2)
if len(split_string) == 1:
host = split_string[0].split(",")
if len(host) == 1:
return 0, 0, split_string[0], None
return 0, 0, host[0], host[1]
if len(split_string) == 2:
host = split_string[1].split(",")
if len(host) == 1:
return 0, split_string[0], host[0], None
return 0, split_string[0], host[0], host[1]
host = split_string[2].split(",")
if ";" in bmp_str:
raise NotImplementedError(
"cfg bmp_names no longer supports cabinet and frame")
host = bmp_str.split(",")
if len(host) == 1:
return split_string[0], split_string[1], host[0], None
return split_string[0], split_string[1], host[0], host[1]
return bmp_str, None
return host[0], host[1]


def _parse_bmp_boards(bmp_boards):
Expand Down Expand Up @@ -153,12 +145,11 @@ def _parse_bmp_connection(bmp_detail):
:rtype: ~.BMPConnectionData
"""
pieces = bmp_detail.split("/")
(cabinet, frame, hostname, port_num) = \
_parse_bmp_cabinet_and_frame(pieces[0])
(hostname, port_num) = _parse_bmp_cabinet_and_frame(pieces[0])
# if there is no split, then assume its one board, located at 0
boards = [0] if len(pieces) == 1 else _parse_bmp_boards(pieces[1])
port_num = None if port_num is None else int(port_num)
return BMPConnectionData(cabinet, frame, hostname, boards, port_num)
return BMPConnectionData(hostname, boards, port_num)


def _parse_bmp_details(bmp_string):
Expand All @@ -168,9 +159,11 @@ def _parse_bmp_details(bmp_string):
:param str bmp_string: the BMP string to be converted
:return: the BMP connection data
:rtype: list(~.BMPConnectionData) or None
:rtype: ~.BMPConnectionData or None
"""
if bmp_string is None or bmp_string == "None":
return None
return [_parse_bmp_connection(bmp_connection)
for bmp_connection in bmp_string.split(":")]
if ":" in bmp_string:
raise NotImplementedError(
"bmp_names can no longer contain multiple bmps")
return _parse_bmp_connection(bmp_string)

0 comments on commit ef0e8f2

Please sign in to comment.