def synchronize_on_task(taskname, timeout=600):
    waitfor = set()
    for vmdef in env.appdef['vms']:
        if vmdef['name'] not in env.vms:
            continue
        for taskdef in vmdef['tasks']:
            if taskdef['name'] == taskname:
                waitfor.add(vmdef['name'])
    state = {}
    end_time = time.time() + timeout
    while True:
        for vmdef in env.appdef['vms']:
            vmname = vmdef['name']
            vmstate = env.shared_state[vmname]  # resync
            if vmstate['exited']:
                state[vmname] = vmstate
                break
            if vmname not in waitfor:
                continue
            if taskname in vmstate['completed_tasks']:
                waitfor.remove(vmname)
                state[vmname] = vmstate
        if vmstate['exited'] or not waitfor:
            break
        console.debug('Waiting for %s' % repr(waitfor))
        time.sleep(5)
        if time.time() > end_time:
            error.raise_error("Timeout waiting for task `{0}`.", taskname)
    return state
Wait until all instances of ``taskname`` have completed.
dataset/ETHPy150Open ravello/testmill/lib/testmill/tasks.py/synchronize_on_task