# HG changeset patch # User Mads Kiilerich # Date 2020-02-13 16:41:51 # 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 --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,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 @@ def celery_run(celery_args): 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 --git a/kallithea/controllers/admin/repos.py b/kallithea/controllers/admin/repos.py --- a/kallithea/controllers/admin/repos.py +++ b/kallithea/controllers/admin/repos.py @@ -28,6 +28,7 @@ Original author and date, and relevant c import logging import traceback +import celery.result import formencode from formencode import htmlfill from tg import request @@ -182,9 +183,8 @@ class ReposController(BaseRepoController 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 --git a/kallithea/lib/celerypylons/__init__.py b/kallithea/lib/celerypylons/__init__.py --- a/kallithea/lib/celerypylons/__init__.py +++ b/kallithea/lib/celerypylons/__init__.py @@ -15,16 +15,7 @@ mandatory settings. """ 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):