__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:sbds 作者: steemit 项目源码 文件源码
def get_checkpoints_from_s3_path(path):
    import boto3
    s3_resource = boto3.resource('s3')
    bucket_name, key_name = split_s3_bucket_key(path)
    bucket = s3_resource.Bucket(bucket_name)
    all_objects = list(bucket.objects.filter(Prefix=key_name))
    all_keys = [o.key for o in all_objects]
    keys = fnmatch.filter(all_keys, S3_KEY_PATTERN)
    checkpoints = []
    for f in keys:
        try:
            file_path = os.path.join(bucket_name, f)
            checkpoints.append(parse_checkpoint_s3_path(file_path))
        except ValueError:
            continue
    return sorted(checkpoints, key=lambda cp: cp.start)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号