|
37 | 37 | # defaults -- can change on command line
|
38 | 38 | COLLECTION_KEYS = {'foo' : '_id', 'bar': 'key'}
|
39 | 39 |
|
| 40 | +def AFTER_SETUP(): |
| 41 | + # feel free to change any of this |
| 42 | + # admin and conn are both defined globaly |
| 43 | + admin.command('enablesharding', 'test') |
| 44 | + |
| 45 | + for (collection, key) in COLLECTION_KEYS.iteritems(): |
| 46 | + admin.command('shardcollection', 'test.'+collection, key={ key : 1 }) |
| 47 | + |
| 48 | + admin.command('shardcollection', 'test.fs.files', key={'_id':1}) |
| 49 | + admin.command('shardcollection', 'test.fs.chunks', key={'files_id':1}) |
| 50 | + |
| 51 | + |
| 52 | +# END CONFIGURATION |
| 53 | + |
40 | 54 | for x in sys.argv[1:]:
|
41 | 55 | opt = x.split("=", 1)
|
42 | 56 | if opt[0] != '--help' and len(opt) != 2:
|
|
56 | 70 | else:
|
57 | 71 | COLLECTION_KEYS[opt[0]] = opt[1]
|
58 | 72 |
|
59 |
| -def AFTER_SETUP(): |
60 |
| - # feel free to change any of this |
61 |
| - # admin and conn are both defined globaly |
62 |
| - admin.command('enablesharding', 'test') |
63 |
| - |
64 |
| - for (collection, key) in COLLECTION_KEYS.iteritems(): |
65 |
| - admin.command('shardcollection', 'test.'+collection, key={ key : 1 }) |
66 |
| - |
67 |
| - admin.command('shardcollection', 'test.fs.files', key={'_id':1}) |
68 |
| - admin.command('shardcollection', 'test.fs.chunks', key={'files_id':1}) |
69 |
| - |
70 |
| - |
71 |
| -# END CONFIGURATION |
72 |
| - |
73 | 73 | # fixed "colors"
|
74 | 74 | RESET = 0
|
75 | 75 | INVERSE = 7
|
|
0 commit comments