Skip to content

Commit 67b3df2

Browse files
committed
move options parsing out of config block of sharding script
1 parent dbdee8a commit 67b3df2

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

sharding/simple-setup.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
# defaults -- can change on command line
3838
COLLECTION_KEYS = {'foo' : '_id', 'bar': 'key'}
3939

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+
4054
for x in sys.argv[1:]:
4155
opt = x.split("=", 1)
4256
if opt[0] != '--help' and len(opt) != 2:
@@ -56,20 +70,6 @@
5670
else:
5771
COLLECTION_KEYS[opt[0]] = opt[1]
5872

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-
7373
# fixed "colors"
7474
RESET = 0
7575
INVERSE = 7

0 commit comments

Comments
 (0)