# HG changeset patch # User Mads Kiilerich # Date 1581608511 -3600 # Node ID 046fbed12f70f9ccd52a22c908ca912615d36249 # Parent 3b1b440b5082bfeeb2ebcfdcbc07916b09386865 celery: use celery directly instead of leaky abstraction in celerypylons Things start making more sense when we remove unnecessary complexity ... diff -r 3b1b440b5082 -r 046fbed12f70 kallithea/bin/kallithea_cli_celery.py --- a/kallithea/bin/kallithea_cli_celery.py Thu Feb 13 16:41:51 2020 +0100 +++ b/kallithea/bin/kallithea_cli_celery.py Thu Feb 13 16:41:51 2020 +0100 @@ -12,11 +12,11 @@ # 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 import kallithea import kallithea.bin.kallithea_cli_base as cli_base -from kallithea.lib import celerypylons @cli_base.register_command(config_file_initialize_app=True) @@ -36,5 +36,5 @@ raise Exception('Please set use_celery = true in .ini config ' 'file before running this command') - cmd = celerypylons.worker.worker(kallithea.CELERY_APP) + cmd = celery.bin.worker.worker(kallithea.CELERY_APP) return cmd.run_from_argv(None, command='celery-run -c CONFIG_FILE --', argv=list(celery_args)) diff -r 3b1b440b5082 -r 046fbed12f70 kallithea/controllers/admin/repos.py --- a/kallithea/controllers/admin/repos.py Thu Feb 13 16:41:51 2020 +0100 +++ b/kallithea/controllers/admin/repos.py Thu Feb 13 16:41:51 2020 +0100 @@ -28,6 +28,7 @@ import logging import traceback +import celery.result import formencode from formencode import htmlfill from tg import request @@ -182,9 +183,8 @@ task_id = request.GET.get('task_id') if task_id and task_id not in ['None']: - from kallithea.lib import celerypylons if kallithea.CELERY_APP: - task_result = celerypylons.result.AsyncResult(task_id, app=kallithea.CELERY_APP) + task_result = celery.result.AsyncResult(task_id, app=kallithea.CELERY_APP) if task_result.failed(): raise HTTPInternalServerError(task_result.traceback) diff -r 3b1b440b5082 -r 046fbed12f70 kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py Thu Feb 13 16:41:51 2020 +0100 +++ b/kallithea/lib/celerypylons/__init__.py Thu Feb 13 16:41:51 2020 +0100 @@ -15,16 +15,7 @@ """ import celery -import celery.result as result import tg -from celery.bin import worker -from celery.task import task - - -# mute pyflakes "imported but unused" -assert result -assert worker -assert task def celery_config(config):