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

Function test_worker_set_gpu_env_for_task

tests/test_resources.py:309–328  ·  view source on GitHub ↗
(hq_env: HqEnv)

Source from the content-addressed store, hash-verified

307
308
309def test_worker_set_gpu_env_for_task(hq_env: HqEnv):
310 hq_env.start_server()
311 hq_env.start_worker(args=["--resource", "gpus/nvidia=[0,1]"])
312 hq_env.command(
313 [
314 "submit",
315 "--resource",
316 "gpus/nvidia=2",
317 "--",
318 "bash",
319 "-c",
320 """
321echo $CUDA_VISIBLE_DEVICES
322""",
323 ]
324 )
325 wait_for_job_state(hq_env, 1, "FINISHED")
326 assert list(set(int(v) for v in line.split(",")) for line in read_file(default_task_output()).splitlines()) == [
327 {0, 1}
328 ]
329
330
331@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 7

wait_for_job_stateFunction · 0.85
read_fileFunction · 0.85
default_task_outputFunction · 0.85
commandMethod · 0.80
start_serverMethod · 0.45
start_workerMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected