Skip to content

Commit

Permalink
avoid default_report_directory pass down
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Nov 23, 2021
1 parent bc61552 commit 3ea7619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
22 changes: 5 additions & 17 deletions spinnman/processes/get_machine_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from os.path import join
from spinn_utilities.config_holder import (
get_config_bool, get_config_int, get_config_str)
from spinn_utilities.data import UtilsDataView
from spinn_utilities.log import FormatAdapter
from spinn_machine import (
Router, Chip, SDRAM, Link, machine_from_size)
Expand Down Expand Up @@ -55,14 +56,9 @@ class GetMachineProcess(AbstractMultiConnectionProcess):
"_p2p_column_data",
# Used if there are any ignore core requests
# Holds a mapping from (x,y) to a mapping of phsyical to virtual core
"_virtual_map",
# Directory to put the ingore report if required
"_default_report_directory",
# Ignore report file path for ignre report.
# Kept as None until first write
"_report_file"]
"_virtual_map"]

def __init__(self, connection_selector, default_report_directory=None):
def __init__(self, connection_selector):
"""
:param connection_selector:
:type connection_selector:
Expand All @@ -81,8 +77,6 @@ def __init__(self, connection_selector, default_report_directory=None):
# Set ethernets to None meaning not computed yet
self._ethernets = None
self._virtual_map = {}
self._default_report_directory = default_report_directory
self._report_file = None

def _make_chip(self, chip_info, machine):
""" Creates a chip from a ChipSummaryInfo structure.
Expand Down Expand Up @@ -519,12 +513,6 @@ def _report_ignore(self, message, *args):
:param str message:
"""
full_message = message.format(*args) + "\n"
if self._report_file is None:
if self._default_report_directory is None:
self._report_file = REPORT_FILE
else:
self._report_file = join(
self._default_report_directory, REPORT_FILE)

with open(self._report_file, "a") as r_file:
report_file = join(UtilsDataView().run_dir_path, REPORT_FILE)
with open(report_file, "a") as r_file:
r_file.write(full_message)
19 changes: 4 additions & 15 deletions spinnman/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
def create_transceiver_from_hostname(
hostname, version, bmp_connection_data=None, number_of_boards=None,
auto_detect_bmp=False, scamp_connections=None,
boot_port_no=None, default_report_directory=None):
boot_port_no=None):
""" Create a Transceiver by creating a :py:class:`~.UDPConnection` to the\
given hostname on port 17893 (the default SCAMP port), and a\
:py:class:`~.BootConnection` on port 54321 (the default boot port),\
Expand All @@ -120,10 +120,6 @@ def create_transceiver_from_hostname(
:param int boot_port_no: the port number used to boot the machine
:param list(SCAMPConnection) scamp_connections:
the list of connections used for SCAMP communications
:param default_report_directory:
Directory to write any reports too.
If ``None`` the current directory will be used.
:type default_report_directory: str or None
:return: The created transceiver
:rtype: Transceiver
:raise SpinnmanIOException:
Expand Down Expand Up @@ -165,8 +161,7 @@ def create_transceiver_from_hostname(
remote_host=hostname, remote_port=boot_port_no))

return Transceiver(
version, connections=connections, scamp_connections=scamp_connections,
default_report_directory=default_report_directory)
version, connections=connections, scamp_connections=scamp_connections)


class Transceiver(AbstractContextManager):
Expand All @@ -190,7 +185,6 @@ class Transceiver(AbstractContextManager):
"_boot_send_connection",
"_chip_execute_lock_condition",
"_chip_execute_locks",
"_default_report_directory",
"_flood_write_lock",
"_height",
"_iobuf_size",
Expand All @@ -212,18 +206,14 @@ class Transceiver(AbstractContextManager):
"_width"]

def __init__(
self, version, connections=None, scamp_connections=None,
default_report_directory=None):
self, version, connections=None, scamp_connections=None):
"""
:param int version: The version of the board being connected to
:param list(Connection) connections:
An iterable of connections to the board. If not specified, no
communication will be possible until connections are found.
:param list(SocketAddressWithChip) scamp_connections:
a list of SCAMP connection data or None
:param str default_report_directory:
Directory to write any reports too. If ``None`` the current
directory will be used.
:raise SpinnmanIOException:
If there is an error communicating with the board, or if no
connections to the board can be found (if connections is ``None``)
Expand Down Expand Up @@ -329,7 +319,6 @@ def __init__(
self._check_bmp_connections()

self._machine_off = False
self._default_report_directory = default_report_directory

def _identify_connections(self, connections):
for conn in connections:
Expand Down Expand Up @@ -557,7 +546,7 @@ def _update_machine(self):

# Get the details of all the chips
get_machine_process = GetMachineProcess(
self._scamp_connection_selector, self._default_report_directory)
self._scamp_connection_selector)
self._machine = get_machine_process.get_machine_details(
version_info.x, version_info.y, self._width, self._height)

Expand Down

0 comments on commit 3ea7619

Please sign in to comment.