From 599b92690b8d3fa2aee6524d6240961bc0cf973e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 27 Nov 2024 14:31:45 +0000 Subject: [PATCH 1/2] pass params not kwarg to job --- .../interface_functions/spalloc_allocator.py | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) 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 088a5bcd2..3999d84b8 100644 --- a/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py +++ b/spinn_front_end_common/interface/interface_functions/spalloc_allocator.py @@ -388,27 +388,20 @@ def _allocate_job_old(spalloc_server: str, n_boards: int) -> Tuple[ :param int n_boards: The number of boards required :rtype: tuple(str, dict(tuple(int,int),str), MachineAllocationController) """ - host, port, user = parse_old_spalloc( + host, port, owner = parse_old_spalloc( spalloc_server, get_config_int("Machine", "spalloc_port"), get_config_str("Machine", "spalloc_user")) - spalloc_kwargs = { - 'hostname': host, - 'port': port, - 'owner': user - } - spalloc_machine = get_config_str_or_none("Machine", "spalloc_machine") - - if spalloc_machine is not None: - spalloc_kwargs['machine'] = spalloc_machine + machine = get_config_str_or_none("Machine", "spalloc_machine") job, hostname, scamp_connection_data = _launch_checked_job_old( - n_boards, spalloc_kwargs) + n_boards, host, port, owner, machine) machine_allocation_controller = _OldSpallocJobController(job, hostname) return (hostname, scamp_connection_data, machine_allocation_controller) -def _launch_checked_job_old(n_boards: int, spalloc_kwargs: dict) -> Tuple[ - Job, str, Dict[XY, str]]: +def _launch_checked_job_old( + n_boards: int, host: str, port: int, owner: str, + machine: Optional[str]) -> Tuple[Job, str, Dict[XY, str]]: """ :rtype: tuple(~.Job, str, dict(tuple(int,int),str)) """ @@ -417,7 +410,8 @@ def _launch_checked_job_old(n_boards: int, spalloc_kwargs: dict) -> Tuple[ avoid_jobs = [] try: while True: - job = Job(n_boards, **spalloc_kwargs) + job = Job(n_boards, hostname=host, port=port, owner=owner, + machine=machine) try: job.wait_until_ready() # get param from jobs before starting, so that hanging doesn't @@ -454,4 +448,5 @@ def _launch_checked_job_old(n_boards: int, spalloc_kwargs: dict) -> Tuple[ del connections[key] for avoid_job in avoid_jobs: avoid_job.destroy("Asked to avoid by cfg") + assert hostname is not None return job, hostname, connections From a46191f480327365894ae4cb2428ef16fcdaf6ec Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 27 Nov 2024 15:48:01 +0000 Subject: [PATCH 2/2] typing --- spinn_front_end_common/data/fec_data_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spinn_front_end_common/data/fec_data_writer.py b/spinn_front_end_common/data/fec_data_writer.py index 0a79ca674..8f822be6e 100644 --- a/spinn_front_end_common/data/fec_data_writer.py +++ b/spinn_front_end_common/data/fec_data_writer.py @@ -564,7 +564,7 @@ def clear_notification_protocol(self) -> None: @classmethod @overrides(FecDataView.add_vertex) - def add_vertex(cls, vertex: ApplicationVertex): + def add_vertex(cls, vertex: ApplicationVertex) -> None: # Avoid the safety check in FecDataView PacmanDataWriter.add_vertex(vertex)