Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from celery import Celery
- def make_celery(app):
- celery = Celery(
- 'test-cargill',
- broker=app.config['CELERY_BROKER_URL'],
- config_source={
- 'broker_transport_options': {
- 'never_list_queues': True,
- 'predefined_queue_urls': {
- 'test-cargill': 'https://sqs.us-east-1.amazonaws.com/469960938340/test-cargill' ,
- },
- },
- 'task_default_queue': 'test-cargill',
- },
- )
- celery.conf.update(app.config)
- class ContextTask(celery.Task):
- def __call__(self, *args, **kwargs):
- with app.app_context():
- return self.run(*args, **kwargs)
- celery.Task = ContextTask
- return celery
Add Comment
Please, Sign In to add comment