def wait_for(client: ArmadaClient, queue, job_set_id=None): """ Waits for a queue and optionally the job_set_id to be active. Ensures that following steps will not fail. """ timeout = 20 while True: try: # queue active test client.get_queue(name=queue) if job_set_id: events = client.get_job_events_stream(queue=queue, job_set_id=job_set_id) for _ in events: break return True except grpc.RpcError as e: code = e.code() if code != grpc.StatusCode.NOT_FOUND: raise e timeout -= 1 time.sleep(1) if timeout <= 0: raise Exception("Timeout")
def test_get_queue(client: ArmadaClient, queue_name): queue = client.get_queue(name=queue_name) assert queue.name == queue_name