~cthier/swift/bench

« back to all changes in this revision

Viewing changes to bin/swift-bench

  • Committer: Chuck Thier
  • Date: 2010-10-04 15:09:53 UTC
  • Revision ID: cthier@gmail.com-20101004150953-pdb9u8lhvhjwasrv
Updated to print usage by default if no args are passed, and added --saio to run with saio defaults

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
# The defaults should be sufficient to run swift-bench on a SAIO
28
28
CONF_DEFAULTS = {
29
 
    'auth': 'http://saio:11000/v1.0',
30
 
    'user': 'test:tester',
31
 
    'key': 'testing',
 
29
    'auth': '',
 
30
    'user': '',
 
31
    'key': '',
32
32
    'object_sources': '',
33
33
    'put_concurrency': '10',
34
34
    'get_concurrency': '10',
47
47
    'timeout': '10',
48
48
    }
49
49
 
 
50
SAIO_DEFAULTS = {
 
51
    'auth': 'http://saio:11000/v1.0',
 
52
    'user': 'test:tester',
 
53
    'key': 'testing',
 
54
    }
 
55
 
50
56
if __name__ == '__main__':
51
57
    usage = "usage: %prog [OPTIONS] [CONF_FILE]"
52
 
    usage += """\n\nConf file (with defaults):
 
58
    usage += """\n\nConf file with SAIO defaults:
53
59
 
54
60
    [bench]
55
61
    auth = http://saio:11000/v1.0
62
68
    delete = yes
63
69
    """
64
70
    parser = OptionParser(usage=usage)
 
71
    parser.add_option('', '--saio', dest='saio', action='store_true',
 
72
                      default=False, help='Run benchmark with SAIO defaults')
65
73
    parser.add_option('-A', '--auth', dest='auth',
66
74
                      help='URL for obtaining an auth token')
67
75
    parser.add_option('-U', '--user', dest='user',
81
89
    parser.add_option('-x', '--no-delete', dest='delete', action='store_false',
82
90
                      help='If set, will not delete the objects created')
83
91
 
84
 
    _, args = parser.parse_args()
 
92
    if len(sys.argv) == 1:
 
93
        parser.print_usage()
 
94
        sys.exit(1)
 
95
    options, args = parser.parse_args()
 
96
    if options.saio:
 
97
        CONF_DEFAULTS.update(SAIO_DEFAULTS)
85
98
    if args:
86
99
        conf = args[0]
87
100
        if not os.path.exists(conf):