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

Function test_manager_autodetect

tests/test_manager.py:54–74  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

52
53
54def test_manager_autodetect(hq_env: HqEnv):
55 hq_env.start_server()
56
57 with hq_env.mock.mock_program_with_code("qstat", qstat_return_walltime("x1234")):
58 with hq_env.mock.mock_program_with_code("scontrol", scontrol_return("y5678")):
59 hq_env.start_worker(cpus=1)
60 hq_env.start_worker(cpus=1, env={"PBS_ENVIRONMENT": "PBS_BATCH", "PBS_JOBID": "x1234"})
61 hq_env.start_worker(cpus=1, env={"SLURM_JOB_ID": "y5678"})
62
63 table = hq_env.command(["worker", "list"], as_table=True)
64 table.check_columns_value(["Manager", "Manager Job ID"], 0, ["None", "N/A"])
65 table.check_columns_value(["Manager", "Manager Job ID"], 1, ["PBS", "x1234"])
66 table.check_columns_value(["Manager", "Manager Job ID"], 2, ["SLURM", "y5678"])
67
68 table = hq_env.command(["worker", "info", "2"], as_table=True)
69 table.check_row_value("Manager", "PBS")
70 table.check_row_value("Time Limit", "58m 49s")
71
72 table = hq_env.command(["worker", "info", "3"], as_table=True)
73 table.check_row_value("Manager", "SLURM")
74 table.check_row_value("Time Limit", "13m 26s")
75
76
77def test_manager_set_none(hq_env: HqEnv):

Callers

nothing calls this directly

Calls 8

qstat_return_walltimeFunction · 0.85
scontrol_returnFunction · 0.85
commandMethod · 0.80
check_columns_valueMethod · 0.80
check_row_valueMethod · 0.80
start_serverMethod · 0.45
start_workerMethod · 0.45

Tested by

no test coverage detected