示例#1
0
文件: benchmark.py 项目: naeloob/s3ql
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(
        description='Measure S3QL write performance, uplink bandwidth and '
        'compression speed and determine limiting factor.')

    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()
    parser.add_storage_url()
    parser.add_argument('file',
                        metavar='<file>',
                        type=argparse.FileType(mode='rb'),
                        help='File to transfer')
    parser.add_argument(
        '--threads',
        metavar='<n>',
        type=int,
        default=None,
        help='Also include statistics for <n> threads in results.')

    parser.add_cachedir()
    return parser.parse_args(args)
示例#2
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(description='Clone an S3QL file system.')

    parser.add_authfile()
    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument(
        "src_storage_url",
        metavar='<source-storage-url>',
        type=storage_url_type,
        help='Storage URL of the source backend that contains the file system')

    parser.add_argument("dst_storage_url",
                        metavar='<destination-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the destination backend')

    parser.add_argument("--threads",
                        type=int,
                        default=3,
                        help='Number of threads to use')

    return parser.parse_args(args)
示例#3
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(
        description='Measure S3QL write performance, uplink bandwidth and '
        'compression speed and determine limiting factor.')

    parser.add_authfile()
    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()
    parser.add_storage_url()
    parser.add_argument(
        'file',
        metavar='<file>',
        type=argparse.FileType(mode='rb'),
        help='File to transfer')
    parser.add_argument(
        '--threads',
        metavar='<n>',
        type=int,
        default=None,
        help='Also include statistics for <n> threads in results.')

    parser.add_cachedir()
    return parser.parse_args(args)
示例#4
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(description='Clone an S3QL file system.')

    parser.add_quiet()
    parser.add_log()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument("--threads",
                        type=int,
                        default=3,
                        help='Number of threads to use')

    # Can't use parser.add_storage_url(), because we need both a source
    # and destination.
    parser.add_argument("--authfile",
                        type=str,
                        metavar='<path>',
                        default=os.path.expanduser("~/.s3ql/authinfo2"),
                        help='Read authentication credentials from this file '
                        '(default: `~/.s3ql/authinfo2)`')
    parser.add_argument(
        "src_storage_url",
        metavar='<source-storage-url>',
        type=storage_url_type,
        help='Storage URL of the source backend that contains the file system')
    parser.add_argument("dst_storage_url",
                        metavar='<destination-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the destination backend')

    options = parser.parse_args(args)
    setup_logging(options)

    # Print message so that the user has some idea what credentials are
    # wanted (if not specified in authfile).
    log.info('Connecting to source backend...')
    options.storage_url = options.src_storage_url
    parser._init_backend_factory(options)
    src_options = argparse.Namespace()
    src_options.__dict__.update(options.__dict__)
    options.src_backend_factory = lambda: src_options.backend_class(src_options
                                                                    )

    log.info('Connecting to destination backend...')
    options.storage_url = options.dst_storage_url
    parser._init_backend_factory(options)
    dst_options = argparse.Namespace()
    dst_options.__dict__.update(options.__dict__)
    options.dst_backend_factory = lambda: dst_options.backend_class(dst_options
                                                                    )
    del options.storage_url
    del options.backend_class

    return options
示例#5
0
文件: clone_fs.py 项目: segator/s3ql
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(
                description='Clone an S3QL file system.')

    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument("--threads", type=int, default=3,
                        help='Number of threads to use')

    # Can't use parser.add_storage_url(), because we need both a source
    # and destination.
    parser.add_argument("--authfile", type=str, metavar='<path>',
                      default=os.path.expanduser("~/.s3ql/authinfo2"),
                      help='Read authentication credentials from this file '
                      '(default: `~/.s3ql/authinfo2)`')
    parser.add_argument("src_storage_url", metavar='<source-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the source backend that contains the file system')
    parser.add_argument("dst_storage_url", metavar='<destination-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the destination backend')


    options = parser.parse_args(args)
    setup_logging(options)

    # Print message so that the user has some idea what credentials are
    # wanted (if not specified in authfile).
    log.info('Connecting to source backend...')
    options.storage_url = options.src_storage_url
    parser._init_backend_factory(options)
    src_options = argparse.Namespace()
    src_options.__dict__.update(options.__dict__)
    options.src_backend_factory = lambda: src_options.backend_class(src_options)

    log.info('Connecting to destination backend...')
    options.storage_url = options.dst_storage_url
    parser._init_backend_factory(options)
    dst_options = argparse.Namespace()
    dst_options.__dict__.update(options.__dict__)
    options.dst_backend_factory = lambda: dst_options.backend_class(dst_options)
    del options.storage_url
    del options.backend_class

    return options
示例#6
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(description='Batch remove objects from an S3QL backend')

    parser.add_storage_url()
    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument("file", type=argparse.FileType(mode='r', encoding='utf-8'),
                        help='File with newline separated object keys to delete')

    return parser.parse_args(args)
示例#7
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(
        description='Batch remove objects from an S3QL backend')

    parser.add_storage_url()
    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument(
        "file",
        type=argparse.FileType(mode='r', encoding='utf-8'),
        help='File with newline separated object keys to delete')

    return parser.parse_args(args)
示例#8
0
def parse_args(args):
    '''Parse command line'''

    parser = ArgumentParser(
                description='Clone an S3QL file system.')

    parser.add_authfile()
    parser.add_quiet()
    parser.add_debug()
    parser.add_backend_options()
    parser.add_version()

    parser.add_argument("src_storage_url", metavar='<source-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the source backend that contains the file system')

    parser.add_argument("dst_storage_url", metavar='<destination-storage-url>',
                        type=storage_url_type,
                        help='Storage URL of the destination backend')

    parser.add_argument("--threads", type=int, default=3,
                        help='Number of threads to use')

    return parser.parse_args(args)