def check_job_status(portal, item_id, job_id, job_type, check_interval=10):
    status = ''
    while status not in ['failed', 'completed']:
        resp = portal.job_status(item_id, job_id, job_type)
        status = resp.get('status')
        time.sleep(check_interval)
    return resp
Checks job status.
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/PublishHostedServices.py/check_job_status