Skip to content

Commit

Permalink
Merge pull request #412 from SpiNNakerManchester/spalloc_get_job
Browse files Browse the repository at this point in the history
Allow getting of an existing job
  • Loading branch information
Christian-B authored Jul 23, 2024
2 parents 8b0e819 + 856dfc4 commit c6a7f14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions spinnman/spalloc/spalloc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions spinnman/utilities/locate_connected_machine_ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c6a7f14

Please sign in to comment.