Mercurial > kallithea
changeset 8244:046fbed12f70
celery: use celery directly instead of leaky abstraction in celerypylons
Things start making more sense when we remove unnecessary complexity ...
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 13 Feb 2020 16:41:51 +0100 |
parents | 3b1b440b5082 |
children | 1e8458068791 |
files | kallithea/bin/kallithea_cli_celery.py kallithea/controllers/admin/repos.py kallithea/lib/celerypylons/__init__.py |
diffstat | 3 files changed, 4 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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 <http://www.gnu.org/licenses/>. +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))
--- 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)
--- 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):