def _wait_for_new_device(base, expected_size, time_limit=60):
    start_time = time.time()
    elapsed_time = time.time() - start_time
    while elapsed_time < time_limit:
        for device in list(set(FilePath(b"/sys/block").children()) -
                           set(base)):
            device_name = device.basename()
            if (device_name.startswith((b"sd", b"xvd")) and
                    _get_device_size(device_name) == expected_size):
                return FilePath(b"/dev").child(device_name)
        time.sleep(0.1)
        elapsed_time = time.time() - start_time

    # If we failed to find a new device of expected size,
    # log sizes of all new devices on this compute instance,
    # for debuggability.
    new_devices = list(
        device.basename()
        for device in set(FilePath(b"/sys/block").children()) - set(base)
    )
    new_devices_size = list(
        _get_device_size(device_name)
        for device_name in new_devices
    )
    NO_NEW_DEVICE_IN_OS(new_devices=new_devices,
                        new_devices_size=new_devices_size,
                        expected_size=expected_size,
                        time_limit=time_limit).write()
    return None
Execute mapper's executor task.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/ebs.py/_wait_for_new_device--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/mapreduce/test_support.py/execute_task