def all_tasks_finished(tasks):
    """Returns True if all rq jobs are finished."""
    for task in tasks:
        job = task.get_rq_job()
        if job is None:
            # if job is not in queue anymore, it finished successfully
            continue
        if not job.is_finished:
            return False
    return True