def assert_job_succeeds(job): assert job.state == 'pending' while request_link(job, 'state') in ('pending', 'running'): time.sleep(1) state = request_link(job, 'state') if state == 'failed': # Refresh to get 'errors' ref job = request_link(job, 'self') errors = request_link(job, 'errors') pytest.fail('Job failed: ' + str(errors)) assert state == 'completed'
def get_file_content(file): """Download the contents of a file. Parameters ---------- file : str or dict, optional Name, or, or file information as returned by :func:`get_file`. Returns ------- content """ file = get_file(file) return request_link(file, 'content')