def wait_for_job_completion(session, job_id, completion_status):
    status_poll_count = 0
    while status_poll_count < 20:
        response = session.read('taskFrameworkJobs', uri_parameters={'jobId': job_id})
        session.view_response(response)
        status = response['body']['jobInstances']['jobInstance']['status']
        if status == completion_status:
            return True
        else:
            time.sleep(30)
            status_poll_count += 1

    raise Exception('Timeout waiting for Job to complete')
dataset/ETHPy150Open vmware/nsxramlclient/tests/vxlanprep.py/wait_for_job_completion/original