pass concurrency option to celery worker

This commit is contained in:
yangdsh 2020-04-21 23:28:26 +00:00 committed by Dana Van Aken
parent efcc2ee74b
commit 33f78f7302
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,12 @@ class Command(BaseCommand):
default='threads', default='threads',
help='Pool implementation: prefork (default), eventlet, gevent, solo or threads.' help='Pool implementation: prefork (default), eventlet, gevent, solo or threads.'
'Default: threads.') 'Default: threads.')
parser.add_argument(
'--concurrency',
metavar='POOL_CLS',
default='4',
help='Number of celery tasks that can run in concurrency'
'Default: 4')
parser.add_argument( parser.add_argument(
'--celery-pidfile', '--celery-pidfile',
metavar='PIDFILE', metavar='PIDFILE',
@ -95,6 +101,7 @@ class Command(BaseCommand):
celery_options = [ celery_options = [
'--loglevel={}'.format(loglevel), '--loglevel={}'.format(loglevel),
'--pool={}'.format(options['pool']), '--pool={}'.format(options['pool']),
'--concurrency={}'.format(options['concurrency']),
'--pidfile={}'.format(options['celery_pidfile']), '--pidfile={}'.format(options['celery_pidfile']),
] + self._parse_suboptions(options['celery_options']) ] + self._parse_suboptions(options['celery_options'])
celerybeat_options = [ celerybeat_options = [