def produceVDIDSlicesForEntireS3Dataset(s3InterfaceFactory, s3Dataset, vdm):
    s3Interface, bucketname, keyPrefix = parseS3Dataset(s3InterfaceFactory, s3Dataset)

    if s3Interface.bucketExists(bucketname) and s3Interface.keyExists(bucketname, keyPrefix):
        return produceVDIDSlicesForSingleBucketKeyPair(s3Interface,
                                                       bucketname,
                                                       keyPrefix,
                                                       s3Dataset)
    else:
        if not s3Interface.bucketExists(bucketname):
            logging.info("Can't load dataset. Bucket '%s' doesn't exist.", bucketname)
            raise InvalidDatasetException("No bucket matching '%s'" % str(bucketname))

        keysAndSizesMatching = s3Interface.listKeysWithPrefix(bucketname, keyPrefix + "_")

        indicesKeysAndSizes = []

        for key, size, mtime in keysAndSizesMatching:
            try:
                index = int(key[len(keyPrefix)+1:])
                indicesKeysAndSizes.append((index, key, size))
            except __HOLE__:
                pass

        keysAndSizesMatching = [(key, size) for _, key, size in sorted(indicesKeysAndSizes)]

    if not keysAndSizesMatching:
        raise InvalidDatasetException(
            "No keys matching %s/%s in %s" % (bucketname, keyPrefix, s3Interface)
            )

    slices = []

    for key, _ in keysAndSizesMatching:
        slices.extend(
            produceVDIDSlicesForSingleBucketKeyPair(s3Interface, bucketname, key, s3Dataset)
            )

    return slices
dataset/ETHPy150Open ufora/ufora/ufora/FORA/python/PythonIoTasks.py/produceVDIDSlicesForEntireS3Dataset