Skip to content

Commit

Permalink
Merge branch 'master' into Transceiver_not_a_ContextManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B authored Aug 3, 2023
2 parents 7ecd81c + f4f1847 commit d8aec49
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 163 deletions.
3 changes: 1 addition & 2 deletions spinnman/board_test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def set_up_remote_board(self):
if self.bmp_names == "None":
self.bmp_names = None
else:
self.bmp_names = [BMPConnectionData(
0, 0, self.bmp_names, [0], None)]
self.bmp_names = [BMPConnectionData(self.bmp_names, [0], None)]
self.auto_detect_bmp = \
self._config.getboolean("Machine", "auto_detect_bmp")
self.localport = _PORT
Expand Down
26 changes: 2 additions & 24 deletions spinnman/connections/udp_packet_connections/bmp_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class BMPConnection(UDPConnection, AbstractSCPConnection):
A BMP connection which supports queries to the BMP of a SpiNNaker machine.
"""
__slots__ = [
"_boards",
"_cabinet",
"_frame"]
"_boards"]

def __init__(self, connection_data):
"""
Expand All @@ -42,28 +40,8 @@ def __init__(self, connection_data):
else connection_data.port_num
super().__init__(
remote_host=connection_data.ip_address, remote_port=port)
self._cabinet = connection_data.cabinet
self._frame = connection_data.frame
self._boards = connection_data.boards

@property
def cabinet(self):
"""
The cabinet ID of the BMP.
:rtype: int
"""
return self._cabinet

@property
def frame(self):
"""
The frame ID of the BMP.
:rtype: int
"""
return self._frame

@property
def boards(self):
"""
Expand Down Expand Up @@ -106,7 +84,7 @@ def send_scp_request(self, scp_request):

def __repr__(self):
return (
f"BMPConnection(cabinet={self._cabinet}, frame={self._frame}, "
f"BMPConnection("
f"boards={self._boards}, local_host={self.local_ip_address}, "
f"local_port={self.local_port}, "
f"remote_host={self.remote_ip_address}, "
Expand Down
41 changes: 10 additions & 31 deletions spinnman/extended/extended_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def execute_application(self, executable_targets, app_id):
# Send a signal telling the application to start
self.send_signal(app_id, Signal.START)

def set_led(self, led, action, board, cabinet, frame):
def set_led(self, led, action, board):
"""
Set the LED state of a board in the machine.
Expand All @@ -442,19 +442,16 @@ def set_led(self, led, action, board, cabinet, frame):
:param LEDAction action:
State to set the LED to, either on, off or toggle
:param board: Specifies the board to control the LEDs of. This may
also be an iterable of multiple boards (in the same frame). The
also be an iterable of multiple boards. The
command will actually be sent to the first board in the iterable.
:type board: int or iterable(int)
:param int cabinet: the cabinet this is targeting
:param int frame: the frame this is targeting
"""
warn_once(logger, "The set_led method is deprecated and "
"untested due to no known use.")
process = SendSingleCommandProcess(
self._bmp_connection(cabinet, frame))
process = SendSingleCommandProcess(self._bmp_selector)
process.execute(BMPSetLed(led, action, board))

def read_adc_data(self, board, cabinet, frame):
def read_adc_data(self, board):
"""
Read the BMP ADC data.
Expand All @@ -463,16 +460,13 @@ def read_adc_data(self, board, cabinet, frame):
known use. Same functionality provided by ybug and bmpc.
Retained in case needed for hardware debugging.
:param int cabinet: cabinet: the cabinet this is targeting
:param int frame: the frame this is targeting
:param int board: which board to request the ADC data from
:return: the FPGA's ADC data object
:rtype: ADCInfo
"""
warn_once(logger, "The read_adc_data method is deprecated and "
"untested due to no known use.")
process = SendSingleCommandProcess(
self._bmp_connection(cabinet, frame))
process = SendSingleCommandProcess(self._bmp_selector)
response = process.execute(ReadADC(board))
return response.adc_info # pylint: disable=no-member

Expand Down Expand Up @@ -791,26 +785,11 @@ def number_of_boards_located(self):
"""
warn_once(logger, "The number_of_boards_located method is deprecated "
"and likely to be removed.")
boards = 0
for bmp_connection in self._bmp_connections:
boards += len(bmp_connection.boards)

# if no BMPs are available, then there's still at least one board
return max(1, boards)

@property
def bmp_connection(self):
"""
The BMP connections.
.. warning::
This property is currently deprecated and likely to be removed.
:rtype: dict(tuple(int,int),MostDirectConnectionSelector)
"""
warn_once(logger, "The bmp_connection property is deprecated and "
"likely to be removed.")
return self._bmp_connection_selectors
if self._bmp_connection is not None:
return max(1, len(self._bmp_connection.boards))
else:
# if no BMPs are available, then there's still at least one board
return 1

def get_heap(self, x, y, heap=SystemVariableDefinition.sdram_heap_address):
"""
Expand Down
27 changes: 2 additions & 25 deletions spinnman/model/bmp_connection_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,15 @@ class BMPConnectionData(object):
"""
__slots__ = [
"_boards",
"_cabinet",
"_frame",
"_ip_address",
"_port_num"]

def __init__(self, cabinet, frame, ip_address, boards, port_num):
def __init__(self, ip_address, boards, port_num):
# pylint: disable=too-many-arguments
self._cabinet = cabinet
self._frame = frame
self._ip_address = ip_address
self._boards = boards
self._port_num = port_num

@property
def cabinet(self):
"""
The cabinet number.
:rtype: int
"""
return self._cabinet

@property
def frame(self):
"""
The frame number.
:rtype: int
"""
return self._frame

@property
def ip_address(self):
"""
Expand Down Expand Up @@ -78,8 +56,7 @@ def port_num(self):
return self._port_num

def __str__(self):
return (f"{self._cabinet}:{self._frame}:{self._ip_address}:"
f"{self._boards}:{self._port_num}")
return (f"{self._ip_address}:{self._boards}:{self._port_num}")

def __repr__(self):
return self.__str__()
6 changes: 2 additions & 4 deletions spinnman/spinnman.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ report_waiting_logs = False
turn_off_machine = False

# format is:
# bmp_names = <bmp_id>[:<bmp_id>]*
# <bmp_id> = [[<cabinet_id>;]<frame_id>;]<host>[/(<board-range>|board_id[,board_id]*)]
# bmp_names = <host>[/(<board-range>|board_id[,board_id]*)
# <board_range> = <board_id>-<board_id>
# where:
# <cabinet_id> is the ID of a cabinet
# <frame_id> is the ID of a frame in a cabinet
# <host> is the hostname or IP address of the BMP
# <board_range> is a range of boards that the BMP can speak to
# <board_id> is the ID of a single board in a frame
# Note this no longer supports multiple host nor cabinet or frame
bmp_names = None

auto_detect_bmp = False
Loading

0 comments on commit d8aec49

Please sign in to comment.