diff --git a/kallithea/bin/kallithea_cli_celery.py b/kallithea/bin/kallithea_cli_celery.py --- a/kallithea/bin/kallithea_cli_celery.py +++ b/kallithea/bin/kallithea_cli_celery.py @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import celery.bin.worker import click +from celery.bin.celery import celery as celery_command import kallithea import kallithea.bin.kallithea_cli_base as cli_base @@ -42,5 +42,12 @@ def celery_run(celery_args, config): kallithea.CELERY_APP.loader.on_worker_process_init = lambda: kallithea.config.application.make_app(config.global_conf, **config.local_conf) - cmd = celery.bin.worker.worker(kallithea.CELERY_APP) - return cmd.run_from_argv(None, command='celery-run -c CONFIG_FILE --', argv=list(celery_args)) + args = list(celery_args) + # args[0] is generally ignored when prog_name is specified, but -h *needs* it to be 'worker' ... but will also suggest that users specify 'worker' explicitly + if not args or args[0] != 'worker': + args.insert(0, 'worker') + + # inline kallithea.CELERY_APP.start in order to allow specifying prog_name + assert celery_command.params[0].name == 'app' + celery_command.params[0].default = kallithea.CELERY_APP + celery_command.main(args=args, prog_name='kallithea-cli celery-run -c CONFIG_FILE --') diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ requirements = [ "Mako >= 0.9.1, < 1.2", "Pygments >= 2.2.0, < 2.7", "Whoosh >= 2.7.1, < 2.8", - "celery >= 4.3, < 4.5, != 4.4.4", # 4.4.4 is broken due to unexpressed dependency on 'future', see https://github.com/celery/celery/pull/6146 + "celery >= 5, < 5.1", "Babel >= 1.3, < 2.9", "python-dateutil >= 2.1.0, < 2.9", "Markdown >= 2.2.1, < 3.2",