From e5dcb571a6de91820637c9f7ec0d1422e06ebd44 Mon Sep 17 00:00:00 2001 From: Is Isilon Date: Mon, 20 Apr 2015 17:06:13 +1200 Subject: [PATCH] Bugfix --- README.md | 4 +++- bin/control | 6 +++--- conf.d/celeryconfig.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3d25973..24e2a64 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ Cartridge to Expose Celery as a Daemon on OpenShift. Status --------------------- -This work on unscaled applications but doesn't work as a gearin a scaled application. Further development can combine this with a python cartridge so it can operate in it's own gears. +This work on unscaled applications but only as a plugin cartridge on scaled applications. This means that it's can't scale independently of your main gear. At this point having a celery cartridge is no better than just starting celery in your app.y or action hooks. Further development can combine this with a python cartridge so it can operate in it's own gears. + +Instead of using this I recommend starting celery in your action hooks or as part of you app.py instead. This will give more flexibility, and example is here https://github.com/appsembler/appsembler-launch-openshift Configuration --------------------- diff --git a/bin/control b/bin/control index 3e32281..1e02bd5 100755 --- a/bin/control +++ b/bin/control @@ -15,14 +15,14 @@ function start { LOGPIPE=${OPENSHIFT_HOMEDIR}/app-root/runtime/logshifter-python rm -f $LOGPIPE && mkfifo $LOGPIPE /usr/bin/logshifter -tag python < $LOGPIPE & - export PYTHONPATH=$OPENSHIFT_DATA_DIR:$OPENSHIFT_DATA_DIR/config/:$OPENSHIFT_REPO_DIR/.openshift:$OPENSHIFT_REPO_DIR/wsgi::$OPENSHIFT_CELERY_DIR/conf.d:$OPENSHIFT_REPO_DIR:$PYTHONPATH - PYTHONPATH=$OPENSHIFT_DATA_DIR:$OPENSHIFT_DATA_DIR/config/:$OPENSHIFT_REPO_DIR/.openshift:$OPENSHIFT_REPO_DIR/wsgi::$OPENSHIFT_CELERY_DIR/conf.d:$OPENSHIFT_REPO_DIR:$PYTHONPATH + export PYTHONPATH=$OPENSHIFT_DATA_DIR:$OPENSHIFT_DATA_DIR/config/:$OPENSHIFT_REPO_DIR/.openshift:$OPENSHIFT_REPO_DIR/config:$OPENSHIFT_REPO_DIR/EXT:$OPENSHIFT_REPO_DIR/wsgi::$OPENSHIFT_CELERY_DIR/conf.d:$OPENSHIFT_REPO_DIR:$PYTHONPATH + PYTHONPATH=$OPENSHIFT_DATA_DIR:$OPENSHIFT_DATA_DIR/config/:$OPENSHIFT_REPO_DIR/.openshift:$OPENSHIFT_REPO_DIR/config:$OPENSHIFT_REPO_DIR/EXT:$OPENSHIFT_REPO_DIR/wsgi::$OPENSHIFT_CELERY_DIR/conf.d:$OPENSHIFT_REPO_DIR:$PYTHONPATH echo "Starting Celery, cmd: ${OPENSHIFT_CELERY_DIR}usr/celery multi start worker --config=${OPENSHIFT_CELERY_CONFIG=celeryconfig} --loglevel=DEBUG --hostname=$OPENSHIFT_APP_DNS --pidfile=${OPENSHIFT_CELERY_DIR}etc/celeryd.pid --logfile=${OPENSHIFT_HOMEDIR}app-root/logs/celery_log.txt" #echo `${OPENSHIFT_CELERY_DIR}usr/celery multi start worker --config=${OPENSHIFT_CELERY_CONFIG=celeryconfig} --loglevel=DEBUG --hostname=$OPENSHIFT_APP_DNS --pidfile=${OPENSHIFT_CELERY_DIR}etc/celeryd.pid --logfile=${OPENSHIFT_HOMEDIR}app-root/logs/celery_log.txt` > ${OPENSHIFT_APP_ROOT}app-root/logs/celery_log.txt nohup ${OPENSHIFT_CELERY_DIR}usr/celery multi start worker --config=${OPENSHIFT_CELERY_CONFIG=celeryconfig} --loglevel=DEBUG --hostname=$OPENSHIFT_APP_DNS --pidfile=${OPENSHIFT_CELERY_DIR}etc/celeryd.pid --logfile=${OPENSHIFT_HOMEDIR}app-root/logs/celery_log.txt &> $LOGPIPE & if ps -p `cat ${OPENSHIFT_CELERY_DIR}etc/celeryd.pid` > /dev/null; then - echo "Startign celery worked" + echo "Starting celery worked" else echo "Startign celery failed" fi diff --git a/conf.d/celeryconfig.py b/conf.d/celeryconfig.py index daae2e1..ac04e6d 100644 --- a/conf.d/celeryconfig.py +++ b/conf.d/celeryconfig.py @@ -13,7 +13,7 @@ BROKER_PORT = 5672 BROKER_USER = "celeryuser" BROKER_PASSWORD = "celery" BROKER_VHOST = "celeryvhost" - +CELERYD_OPTS="--autoscale=3,1 --time-limit=300 --concurrency=2 " CELERY_RESULT_BACKEND = "amqp" # Here we check the env vars first, otherwise go with "tasks"