This file contains hidden or 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
| from os import environ | |
| from flask import Flask | |
| from celery import Celery | |
| app = Flask(__name__) | |
| # Configs | |
| REDIS_HOST = "0.0.0.0" |
This file contains hidden or 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
| from flask import Flask | |
| from celery import Celery | |
| app = Flask(__name__) | |
| app.config.from_object('config') | |
| def make_celery(app): | |
| # create context tasks in celery |
This file contains hidden or 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
| from os import environ | |
| REDIS_HOST = "0.0.0.0" | |
| REDIS_PORT = 6379 | |
| BROKER_URL = environ.get('REDIS_URL', "redis://{host}:{port}/0".format( | |
| host=REDIS_HOST, port=str(REDIS_PORT))) | |
| CELERY_RESULT_BACKEND = BROKER_URL |
This file contains hidden or 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
| import celery | |
| @celery.task() | |
| def print_hello(): | |
| logger = print_hello.get_logger() | |
| logger.info("Hello") |
This file contains hidden or 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
| from celery.schedules import crontab | |
| CELERY_IMPORTS = ('app.tasks.test') | |
| CELERY_TASK_RESULT_EXPIRES = 30 | |
| CELERY_TIMEZONE = 'UTC' | |
| CELERY_ACCEPT_CONTENT = ['json', 'msgpack', 'yaml'] | |
| CELERY_TASK_SERIALIZER = 'json' | |
| CELERY_RESULT_SERIALIZER = 'json' |
This file contains hidden or 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
| from flask import Flask | |
| from celery import Celery | |
| import celeryconfig | |
| app = Flask(__name__) | |
| app.config.from_object('config') | |
| def make_celery(app): |
This file contains hidden or 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 | |
| # This script downloads redis-server | |
| # if redis has not already been downloaded | |
| if [ ! -d redis-3.2.1/src ]; then | |
| wget http://download.redis.io/releases/redis-3.2.1.tar.gz | |
| tar xzf redis-3.2.1.tar.gz | |
| rm redis-3.2.1.tar.gz | |
| cd redis-3.2.1 | |
| make | |
| else |
This file contains hidden or 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
| ; ================================== | |
| ; supervisor config file | |
| ; ================================== | |
| [unix_http_server] | |
| file=/var/run/supervisor.sock ; (the path to the socket file) | |
| [supervisord] | |
| logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
| pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) |
This file contains hidden or 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
| ; ================================ | |
| ; redis supervisor | |
| ; ================================ | |
| [program:redis] | |
| command=/path/to/celery-scheduler/redis-3.2.1/src/redis-server | |
| directory=/path/to/celery-scheduler/redis-3.2.1 | |
| user=root | |
| numprocs=1 |
This file contains hidden or 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
| ; ================================ | |
| ; celery beat supervisor | |
| ; ================================ | |
| [program:celerybeat] | |
| command=/path/to/home/.virtualenvs/celery_env/bin/celery beat -A app.celery --schedule=/tmp/celerybeat-schedule --loglevel=INFO --pidfile=/tmp/celerybeat.pid | |
| directory=/path/to/home/celery-scheduler | |
| user=root | |
| numprocs=1 |
OlderNewer