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

Function test_restore_queue_worker_resources

tests/test_journal.py:249–275  ·  view source on GitHub ↗
(hq_env: HqEnv, tmp_path, flavor: ManagerFlavor)

Source from the content-addressed store, hash-verified

247
248@all_flavors
249def test_restore_queue_worker_resources(hq_env: HqEnv, tmp_path, flavor: ManagerFlavor):
250 journal_path = os.path.join(tmp_path, "my.journal")
251 hq_env.start_server(args=["--journal", journal_path])
252
253 with MockJobManager(hq_env, flavor.default_handler()) as manager:
254 add_queue(
255 hq_env,
256 manager=flavor.manager_type(),
257 )
258 hq_env.command(["submit", "ls"])
259
260 job_id = default_job_id(0)
261 wait_for_alloc(hq_env, "QUEUED", job_id)
262
263 manager.handler.add_worker(hq_env, job_id)
264 wait_for_worker_state(hq_env, [1], "RUNNING")
265
266 alloc_list = hq_env.command(["--output-mode=json", "alloc", "list"], as_json=True)
267 worker_resources = alloc_list[0]["known_worker_resources"]
268 assert worker_resources is not None
269
270 hq_env.stop_server()
271 hq_env.start_server(args=["--journal", journal_path])
272
273 alloc_list2 = hq_env.command(["--output-mode=json", "alloc", "list"], as_json=True)
274 current_worker_resources = alloc_list2[0]["known_worker_resources"]
275 assert worker_resources == current_worker_resources
276
277
278def test_restore_open_job_more_jobs(hq_env: HqEnv, tmp_path):

Callers

nothing calls this directly

Calls 11

MockJobManagerClass · 0.85
default_job_idFunction · 0.85
wait_for_allocFunction · 0.85
wait_for_worker_stateFunction · 0.85
default_handlerMethod · 0.80
commandMethod · 0.80
add_queueFunction · 0.50
start_serverMethod · 0.45
manager_typeMethod · 0.45
add_workerMethod · 0.45
stop_serverMethod · 0.45

Tested by

no test coverage detected