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

Function test_explain_deps

tests/test_explain.py:209–243  ·  view source on GitHub ↗
(hq_env: HqEnv, tmp_path)

Source from the content-addressed store, hash-verified

207
208
209def test_explain_deps(hq_env: HqEnv, tmp_path):
210 hq_env.start_server()
211 hq_env.start_workers(2, cpus=4)
212
213 tmp_path.joinpath("job.toml").write_text(
214 """
215[[task]]
216id = 0
217command = ["sleep", "0"]
218
219[[task]]
220id = 1
221command = ["sleep", "100"]
222
223[[task]]
224id = 2
225command = ["sleep", "1"]
226deps = [0, 1]
227"""
228 )
229 hq_env.command(["job", "submit-file", "job.toml"])
230 wait_for_task_state(hq_env, 1, [0, 1, 2], ["finished", "running", "waiting"])
231 hq_env.command(["job", "submit-file", "job.toml"])
232 r = hq_env.command(["task", "explain", "1", "2"])
233 assert r == snapshot(
234 """Task 1@2 is not ready to run, because 1/2 dependencies are not finished.
235The task can run on 2 workers: 1-2
236+-----------+----------+---------+------+----------+---------+
237| Worker Id | Runnable | Variant | Type | Provides | Request |
238+-----------+----------+---------+------+----------+---------+
239| 1 | Yes | 0 | cpus | 4 | 1 |
240| 2 | Yes | 0 | cpus | 4 | 1 |
241+-----------+----------+---------+------+----------+---------+
242"""
243 )

Callers

nothing calls this directly

Calls 4

wait_for_task_stateFunction · 0.85
commandMethod · 0.80
start_serverMethod · 0.45
start_workersMethod · 0.45

Tested by

no test coverage detected