Created
December 13, 2013 15:48
-
-
Save anthonyrisinger/7946272 to your computer and use it in GitHub Desktop.
CELERY_EVENT_SERIALIZER = 'pickle' rejected by kombu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=; shopt -s nullglob | |
export PIP_REQUIRE_VIRTUALENV= | |
export PYTHONUNBUFFERED=x | |
export PYTHON=$(type -p python2.7 python2.6 python2 python | head -n1) | |
export PIP=$(type -p pip-2.7 pip-2.6 pip2 pip | head -n1) | |
cat <<'EOF' > controller.py | |
# encoding: utf-8 | |
from __future__ import absolute_import | |
import os | |
import sys | |
import uwsgi | |
import celery | |
sys.dont_write_bytecode = True | |
_name_orig, __name__ = __name__, 'controller' | |
sys.modules[__name__] = sys.modules[_name_orig] | |
ident = '%s@' % os.getpid() | |
@celery.shared_task | |
def marco(*args): | |
return 'polo' | |
def worker(core=None): | |
app = celery.Celery() | |
app.conf.CELERY_ACCEPT_CONTENT = ['pickle', 'json'] | |
app.conf.CELERY_EVENT_SERIALIZER = 'pickle' | |
# ^^^^^^^^^^ THIS OPT IS THE PROBLEM! REMOVE TO FIX! | |
worker = app.Worker(hostname=ident, pool_cls='solo') | |
return worker.start() | |
EOF | |
git clone --depth 1 https://github.com/unbit/uwsgi dists/uwsgi 2> /dev/null | |
cd dists/uwsgi && | |
sed -r -i 's/= python/= dumbloop,python/' buildconf/default.ini && ( | |
[[ -x ./uwsgi ]] || ( | |
${PYTHON} uwsgiconfig.py --clean && | |
${PYTHON} uwsgiconfig.py --build | |
) | |
) && ( | |
${PIP} install --target=../ celery==3.1.6 || | |
${PIP} install --user celery==3.1.6 || | |
sudo ${PIP} install celery==3.1.6 | |
) && ( | |
cd ../.. | |
dists/uwsgi/uwsgi \ | |
--master \ | |
--loop=dumb \ | |
--processes=2 \ | |
--enable-threads \ | |
--pythonpath=dists \ | |
--dumbloop-code=controller.py \ | |
--dumbloop-function=worker \ | |
--worker-reload-mercy=2 \ | |
& | |
sleep 4 | |
kill -INT %% | |
wait | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment