def set_options(self, **options):
self.faster = options.pop('faster')
self.queue_worker_amount = int(options.pop('workers'))
self.use_multiprocessing = options.pop('use_multiprocessing')
if self.use_multiprocessing:
self.task_queue = multiprocessing.JoinableQueue()
self.worker_spawn_method = self.mp_spawn
else:
self.task_queue = GeventQueue()
self.worker_spawn_method = self.gevent_spawn
super(Command, self).set_options(**options)
if self.faster:
# The original management command of Django collects all the files and calls the post_process method of
# the storage backend within the same method. Because we are using a task queue, post processing is started
# before all files were collected.
self.post_process_original = self.post_process
self.post_process = False
评论列表
文章目录