def wait_for_task(upid, timeout=300):
    '''
    Wait until a the task has been finished successfully
    '''
    start_time = time.time()