Changeset - 046fbed12f70
[Not reviewed]
default
0 3 0
Mads Kiilerich - 6 years ago 2020-02-13 16:41:51
mads@kiilerich.com
Grafted from: e68bb42cb9f1
celery: use celery directly instead of leaky abstraction in celerypylons

Things start making more sense when we remove unnecessary complexity ...
3 files changed with 4 insertions and 13 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_celery.py
Show inline comments
 
@@ -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 @@ 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))
kallithea/controllers/admin/repos.py
Show inline comments
 
@@ -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)
 

	
kallithea/lib/celerypylons/__init__.py
Show inline comments
 
@@ -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):
0 comments (0 inline, 0 general)