@@ -120,38 +120,29 @@ class Command(LabelCommand):
120
120
help = "Freshens the index for the given app(s)."
121
121
base_options = (
122
122
make_option ('-a' , '--age' , action = 'store' , dest = 'age' ,
123
- default = DEFAULT_AGE , type = 'int' ,
124
- help = 'Number of hours back to consider objects new.'
125
- ),
126
- make_option ('-s' , '--start' , action = 'store' , dest = 'start_date' ,
127
- default = None , type = 'string' ,
128
- help = 'The start date for indexing within. Can be any dateutil-parsable string, recommended to be YYYY-MM-DDTHH:MM:SS.'
129
- ),
130
- make_option ('-e' , '--end' , action = 'store' , dest = 'end_date' ,
131
- default = None , type = 'string' ,
132
- help = 'The end date for indexing within. Can be any dateutil-parsable string, recommended to be YYYY-MM-DDTHH:MM:SS.'
133
- ),
134
- make_option ('-b' , '--batch-size' , action = 'store' , dest = 'batchsize' ,
135
- default = None , type = 'int' ,
136
- help = 'Number of items to index at once.'
137
- ),
138
- make_option ('-r' , '--remove' , action = 'store_true' , dest = 'remove' ,
139
- default = False , help = 'Remove objects from the index that are no longer present in the database.'
140
- ),
123
+ default = DEFAULT_AGE , type = 'int' ,
124
+ help = 'Number of hours back to consider objects new.' ),
125
+ make_option ('-s' , '--start' , action = 'store' , dest = 'start_date' , default = None , type = 'string' ,
126
+ help = 'The start date for indexing within. Can be any dateutil-parsable string,'
127
+ ' recommended to be YYYY-MM-DDTHH:MM:SS.' ),
128
+ make_option ('-e' , '--end' , action = 'store' , dest = 'end_date' , default = None , type = 'string' ,
129
+ help = 'The end date for indexing within. Can be any dateutil-parsable string,'
130
+ ' recommended to be YYYY-MM-DDTHH:MM:SS.' ),
131
+ make_option ('-b' , '--batch-size' , action = 'store' , dest = 'batchsize' , default = None , type = 'int' ,
132
+ help = 'Number of items to index at once.' ),
133
+ make_option ('-r' , '--remove' , action = 'store_true' , dest = 'remove' , default = False ,
134
+ help = 'Remove objects from the index that are no longer present in the database.' ),
141
135
make_option ("-u" , "--using" , action = "append" , dest = "using" ,
142
- default = [],
143
- help = 'Update only the named backend (can be used multiple times). '
144
- 'By default all backends will be updated.'
145
- ),
146
- make_option ('-k' , '--workers' , action = 'store' , dest = 'workers' ,
147
- default = 0 , type = 'int' ,
148
- help = 'Allows for the use multiple workers to parallelize indexing.'
149
- ),
150
- make_option ('--nocommit' , action = 'store_false' , dest = 'commit' ,
151
- default = True , help = 'Will pass commit=False to the backend.'
152
- ),
136
+ default = [],
137
+ help = 'Update only the named backend (can be used multiple times). '
138
+ 'By default all backends will be updated.' ),
139
+ make_option ('-k' , '--workers' , action = 'store' , dest = 'workers' , default = 0 , type = 'int' ,
140
+ help = 'Allows for the use multiple workers to parallelize indexing.' ),
141
+ make_option ('--nocommit' , action = 'store_false' , dest = 'commit' , default = True ,
142
+ help = 'Will pass commit=False to the backend.' ),
153
143
make_option ('-t' , '--max-retries' , action = 'store' , dest = 'max_retries' ,
154
- default = DEFAULT_MAX_RETRIES , type = 'int' ,
144
+ type = 'int' ,
145
+ default = DEFAULT_MAX_RETRIES ,
155
146
help = 'Maximum number of attempts to write to the backend when an error occurs.' ),
156
147
)
157
148
option_list = LabelCommand .option_list + base_options
@@ -248,7 +239,8 @@ def update_backend(self, label, using):
248
239
end = min (start + batch_size , total )
249
240
250
241
if self .workers == 0 :
251
- do_update (backend , index , qs , start , end , total , verbosity = self .verbosity , commit = self .commit , max_retries = self .max_retries )
242
+ do_update (backend , index , qs , start , end , total , verbosity = self .verbosity ,
243
+ commit = self .commit , max_retries = self .max_retries )
252
244
else :
253
245
ghetto_queue .append ((model , start , end , total , using , self .start_date , self .end_date ,
254
246
self .verbosity , self .commit , self .max_retries ))
@@ -301,7 +293,8 @@ def update_backend(self, label, using):
301
293
print (" removing %d stale records." % len (stale_records ))
302
294
303
295
for rec_id in stale_records :
304
- # Since the PK was not in the database list, we'll delete the record from the search index:
296
+ # Since the PK was not in the database list, we'll delete the record from the search
297
+ # index:
305
298
if self .verbosity >= 2 :
306
299
print (" removing %s." % rec_id )
307
300
0 commit comments