MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / test_slurm_allocation_name

Function test_slurm_allocation_name

tests/autoalloc/test_autoalloc.py:612–632  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

610
611
612def test_slurm_allocation_name(hq_env: HqEnv):
613 handler = ExtractSubmitScriptPath(SlurmManagerFlavor().create_adapter())
614
615 def check_name(path: str, name: str):
616 with open(path) as f:
617 data = f.read()
618 slurm_args = extract_script_args(data, "#SBATCH")
619 for arg in slurm_args:
620 if "--job-name=" in arg:
621 assert arg[len("--job-name=") :] == name
622 return
623 raise Exception(f"Slurm name {name} not found in {path}")
624
625 with MockJobManager(hq_env, handler):
626 start_server_with_quick_refresh(hq_env)
627 prepare_tasks(hq_env)
628
629 add_queue(hq_env, manager="slurm", name="foo", backlog=2)
630 check_name(handler.get_script_path(), "foo-1")
631 handler.add_worker(hq_env, default_job_id())
632 check_name(handler.get_script_path(), "foo-2")
633
634
635@all_flavors

Callers

nothing calls this directly

Calls 11

get_script_pathMethod · 0.95
SlurmManagerFlavorClass · 0.85
MockJobManagerClass · 0.85
prepare_tasksFunction · 0.85
check_nameFunction · 0.85
default_job_idFunction · 0.85
add_queueFunction · 0.70
create_adapterMethod · 0.45
add_workerMethod · 0.45

Tested by

no test coverage detected