Skip to content

Commit

Permalink
Merge branch 't_spalloc' into t_fec
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Dec 16, 2024
2 parents 7e04ddd + ecdbefe commit ee021ca
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
"""
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit ee021ca

Please sign in to comment.