diff --git a/spinnman/spalloc/spalloc_client.py b/spinnman/spalloc/spalloc_client.py index 451bfffa8..53c036710 100644 --- a/spinnman/spalloc/spalloc_client.py +++ b/spinnman/spalloc/spalloc_client.py @@ -138,6 +138,17 @@ def __init__( self.__nmpi_user = nmpi_user logger.info("established session to {} for {}", service_url, username) + def get_job(self, job_id: str) -> SpallocJob: + """ + Get a job by its job id. + + :param str job_id: The job id. + :rtype: SpallocJob + """ + assert self.__session + return _SpallocJob( + self.__session, fix_url(f"{self.__jobs_url}/{job_id}")) + @staticmethod def open_job_from_database( service_url, job_url, cookies, headers) -> SpallocJob: diff --git a/spinnman/utilities/locate_connected_machine_ip_address.py b/spinnman/utilities/locate_connected_machine_ip_address.py index eaa734033..6ed26c419 100644 --- a/spinnman/utilities/locate_connected_machine_ip_address.py +++ b/spinnman/utilities/locate_connected_machine_ip_address.py @@ -20,7 +20,7 @@ from spinnman.connections.udp_packet_connections import IPAddressesConnection -def locate_connected_machine(handler: Callable[[str, float], None]): +def locate_connected_machine(handler: Callable[[str, float], bool]): """ Locates any SpiNNaker machines IP addresses from the auto-transmitted packets from non-booted SpiNNaker machines. @@ -51,7 +51,7 @@ def _ctrlc_handler(sig, frame): print("Exiting") sys.exit() - def _print_connected(ip_address: str, timestamp: float): + def _print_connected(ip_address: str, timestamp: float) -> bool: try: hostname = f" ({socket.gethostbyaddr(ip_address)[0]})" except Exception: # pylint: disable=broad-except