From b4d3814c7fa01422b10efb5edc37394d59e79c99 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 16 Aug 2023 09:15:11 +0100 Subject: [PATCH 1/2] move power on and off to Transeciver init --- .../test_write_json_machine.py | 5 --- .../impl/machine_allocation_controller.py | 1 - .../interface_functions/machine_generator.py | 31 ++----------------- .../interface_functions/spalloc_allocator.py | 1 - 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/fec_integration_tests/file_convertor_tests/test_write_json_machine.py b/fec_integration_tests/file_convertor_tests/test_write_json_machine.py index 1fffbd26b7..a0056196cb 100644 --- a/fec_integration_tests/file_convertor_tests/test_write_json_machine.py +++ b/fec_integration_tests/file_convertor_tests/test_write_json_machine.py @@ -111,10 +111,6 @@ def testSpin4(self): if not Ping.host_is_reachable(self.spin4Host): raise unittest.SkipTest(self.spin4Host + " appears to be down") trans = transceiver.create_transceiver_from_hostname(self.spin4Host, 5) - try: - trans.ensure_board_is_ready() - except (SpinnmanIOException): - self.skipTest("Skipping as getting Job failed") machine = trans.get_machine_details() FecDataWriter.mock().set_machine(machine) @@ -156,7 +152,6 @@ def testSpin2(self): self.skipTest("Skipping as getting Job failed") trans = transceiver.create_transceiver_from_hostname(hostname, 5) - trans.ensure_board_is_ready() writer.set_machine(trans.get_machine_details()) m_allocation_controller.close() diff --git a/spinn_front_end_common/abstract_models/impl/machine_allocation_controller.py b/spinn_front_end_common/abstract_models/impl/machine_allocation_controller.py index 1ac17be60e..bf54c44697 100644 --- a/spinn_front_end_common/abstract_models/impl/machine_allocation_controller.py +++ b/spinn_front_end_common/abstract_models/impl/machine_allocation_controller.py @@ -91,7 +91,6 @@ def create_transceiver(self): hostname=self.__hostname, bmp_connection_data=None, version=5, auto_detect_bmp=False) - txrx.ensure_board_is_ready() txrx.discover_scamp_connections() return txrx diff --git a/spinn_front_end_common/interface/interface_functions/machine_generator.py b/spinn_front_end_common/interface/interface_functions/machine_generator.py index fbe34ac053..600964ce2d 100644 --- a/spinn_front_end_common/interface/interface_functions/machine_generator.py +++ b/spinn_front_end_common/interface/interface_functions/machine_generator.py @@ -15,32 +15,14 @@ import re from spinn_utilities.log import FormatAdapter -from spinnman.constants import POWER_CYCLE_WAIT_TIME_IN_SECONDS from spinnman.transceiver import create_transceiver_from_hostname from spinnman.model import BMPConnectionData from spinn_front_end_common.data import FecDataView from spinn_front_end_common.utilities.exceptions import ConfigurationException -import time import logging logger = FormatAdapter(logging.getLogger(__name__)) -POWER_CYCLE_WARNING = ( - "When power-cycling a board, it is recommended that you wait for 30 " - "seconds before attempting a reboot. Therefore, the tools will now " - "wait for 30 seconds. If you wish to avoid this wait, please set " - "reset_machine_on_startup = False in the [Machine] section of the " - "relevant configuration (cfg) file.") - -POWER_CYCLE_FAILURE_WARNING = ( - "The end user requested the power-cycling of the board. But the " - "tools did not have the required BMP connection to facilitate a " - "power-cycling, and therefore will not do so. please set the " - "bmp_names accordingly in the [Machine] section of the relevant " - "configuration (cfg) file. Or use a machine assess process which " - "provides the BMP data (such as a spalloc system) or finally set " - "reset_machine_on_startup = False in the [Machine] section of the " - "relevant configuration (cfg) file to avoid this warning in future.") def machine_generator( @@ -80,23 +62,14 @@ def machine_generator( hostname=FecDataView.get_ipaddress(), bmp_connection_data=_parse_bmp_details(bmp_details), version=board_version, - auto_detect_bmp=auto_detect_bmp) - - if reset_machine_on_start_up: - success = txrx.power_off_machine() - if success: - logger.warning(POWER_CYCLE_WARNING) - time.sleep(POWER_CYCLE_WAIT_TIME_IN_SECONDS) - logger.warning("Power cycle wait complete") - else: - logger.warning(POWER_CYCLE_FAILURE_WARNING) + auto_detect_bmp=auto_detect_bmp, + power_cycle=reset_machine_on_start_up) # do auto boot if possible if board_version is None: raise ConfigurationException( "Please set a machine version number in the " "corresponding configuration (cfg) file") - txrx.ensure_board_is_ready() if scamp_connection_data: txrx.add_scamp_connections(scamp_connection_data) else: diff --git a/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py b/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py index 2eec620a3a..23edfb159f 100644 --- a/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py +++ b/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py @@ -121,7 +121,6 @@ def create_transceiver(self): if not self.__use_proxy: return super(SpallocJobController, self).create_transceiver() txrx = self._job.create_transceiver() - txrx.ensure_board_is_ready() return txrx @overrides(AbstractMachineAllocationController.open_sdp_connection) From bd130797e8d5ba4126bbb01694d4211a24ac8e78 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 16 Aug 2023 10:13:52 +0100 Subject: [PATCH 2/2] flake8 --- .../file_convertor_tests/test_write_json_machine.py | 1 - .../interface/interface_functions/machine_generator.py | 1 - 2 files changed, 2 deletions(-) diff --git a/fec_integration_tests/file_convertor_tests/test_write_json_machine.py b/fec_integration_tests/file_convertor_tests/test_write_json_machine.py index a0056196cb..534d665727 100644 --- a/fec_integration_tests/file_convertor_tests/test_write_json_machine.py +++ b/fec_integration_tests/file_convertor_tests/test_write_json_machine.py @@ -20,7 +20,6 @@ from spinn_utilities.config_holder import set_config from spalloc_client.job import JobDestroyedError from spinn_utilities.ping import Ping -from spinnman.exceptions import SpinnmanIOException import spinnman.transceiver as transceiver from spinn_front_end_common.data.fec_data_writer import FecDataWriter from spinn_front_end_common.interface.config_setup import unittest_setup diff --git a/spinn_front_end_common/interface/interface_functions/machine_generator.py b/spinn_front_end_common/interface/interface_functions/machine_generator.py index 600964ce2d..934d21e8c7 100644 --- a/spinn_front_end_common/interface/interface_functions/machine_generator.py +++ b/spinn_front_end_common/interface/interface_functions/machine_generator.py @@ -24,7 +24,6 @@ logger = FormatAdapter(logging.getLogger(__name__)) - def machine_generator( bmp_details, board_version, auto_detect_bmp, scamp_connection_data, reset_machine_on_start_up):