From 2fa288dc2242e8a1097db60cdae1a7cdcde5b19b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 14 May 2024 10:55:26 +0100 Subject: [PATCH] more typing --- manual_scripts/get_triad.py | 44 ++++++++++++++++++++++++++++++ spinnman/spalloc/spalloc_client.py | 7 +++-- 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 manual_scripts/get_triad.py diff --git a/manual_scripts/get_triad.py b/manual_scripts/get_triad.py new file mode 100644 index 000000000..ff3d39b43 --- /dev/null +++ b/manual_scripts/get_triad.py @@ -0,0 +1,44 @@ +from spinn_utilities.config_holder import set_config +from spinnman.spalloc import SpallocClient +from spinnman.config_setup import unittest_setup + + +SPALLOC_URL = "https://spinnaker.cs.man.ac.uk/spalloc" +SPALLOC_USERNAME = "Christian-test" +SPALLOC_PASSWORD = "Ski1lift" + +SPALLOC_MACHINE = "SpiNNaker1M" + +x = 0 +y = 3 +b = 0 # Must be 0 if requesting a rect +RECT = True +WIDTH = 1 # In triads! +HEIGHT = 1 # In triads! + +unittest_setup() +set_config("Machine", "version",5) +client = SpallocClient(SPALLOC_URL, SPALLOC_USERNAME, SPALLOC_PASSWORD) +if RECT: + job = client.create_job_rect_at_board( + WIDTH, HEIGHT, triad=(x, y, b), machine_name=SPALLOC_MACHINE, + max_dead_boards=1) +else: + job = client.create_job_board( + triad=(x, y, b), machine_name=SPALLOC_MACHINE) +print(job) +print("Waiting until ready...") +with job: + job.wait_until_ready() + print(job.get_connections()) + + txrx = job.create_transceiver() + # This call is for testing and can be changed without notice! + dims = txrx._get_machine_dimensions() + print(f"{dims.height=}, {dims.width=}") + + machine = txrx.get_machine_details() + print(machine) + + input("Press Enter to release...") +client.close()#print(2)#print(2^(1/(2^1))) \ No newline at end of file diff --git a/spinnman/spalloc/spalloc_client.py b/spinnman/spalloc/spalloc_client.py index aa08c131c..f57b0ab23 100644 --- a/spinnman/spalloc/spalloc_client.py +++ b/spinnman/spalloc/spalloc_client.py @@ -209,7 +209,7 @@ def create_job( def create_job_rect( self, width: int, height: int, machine_name: Optional[str] = None, - keepalive = KEEP_ALIVE_PERIOND) -> SpallocJob: + keepalive: int = KEEP_ALIVE_PERIOND) -> SpallocJob: return self._create({ "dimensions": { "width": int(width), @@ -224,7 +224,7 @@ def create_job_board( physical: Optional[Tuple[int, int, int]] = None, ip_address: Optional[str] = None, machine_name: Optional[str] = None, - keepalive = KEEP_ALIVE_PERIOND) -> SpallocJob: + keepalive: int = KEEP_ALIVE_PERIOND) -> SpallocJob: board: JsonObject if triad: x, y, z = triad @@ -248,7 +248,8 @@ def create_job_rect_at_board( triad: Optional[Tuple[int, int, int]] = None, physical: Optional[Tuple[int, int, int]] = None, ip_address: Optional[str] = None, - machine_name: Optional[str] = None, keepalive = KEEP_ALIVE_PERIOND, + machine_name: Optional[str] = None, + keepalive: int = KEEP_ALIVE_PERIOND, max_dead_boards: int = 0) -> SpallocJob: board: JsonObject if triad: