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

Function test_repeated_status_error

tests/autoalloc/test_autoalloc.py:376–397  ·  view source on GitHub ↗

Submit an allocation that will forever be returned as an error when trying to get its status. After some time, that allocation should be removed, to allow new allocations to be started.

(hq_env: HqEnv, flavor: ManagerFlavor)

Source from the content-addressed store, hash-verified

374
375@all_flavors
376def test_repeated_status_error(hq_env: HqEnv, flavor: ManagerFlavor):
377 """
378 Submit an allocation that will forever be returned as an error when trying to get its status.
379 After some time, that allocation should be removed, to allow new allocations to be started.
380 """
381 first_job = default_job_id()
382
383 class FailingStatusManager(CommandHandler):
384 async def handle_status(self, job_ids: List[JobId]) -> Dict[JobId, JobData]:
385 if first_job in job_ids:
386 raise ManagerException("Failed to get allocation status")
387 return await super().handle_status(job_ids)
388
389 with MockJobManager(hq_env, FailingStatusManager(flavor.create_adapter())):
390 start_server_with_quick_refresh(hq_env)
391 prepare_tasks(hq_env)
392
393 add_queue(hq_env, manager=flavor.manager_type(), backlog=1)
394 # Check that after many status failures, the job is deemed to be finished and a new one is
395 # queued.
396 wait_for_alloc(hq_env, "FAILED", first_job)
397 wait_for_alloc(hq_env, "QUEUED", default_job_id(1))
398
399
400@all_flavors

Callers

nothing calls this directly

Calls 9

default_job_idFunction · 0.85
MockJobManagerClass · 0.85
prepare_tasksFunction · 0.85
wait_for_allocFunction · 0.85
add_queueFunction · 0.70
create_adapterMethod · 0.45
manager_typeMethod · 0.45

Tested by

no test coverage detected