Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow getting of an existing job #412

Merged
merged 5 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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