xflash96 / pyramid_celery

Pyramid configuration with celery integration. Allows you to use pyramid .ini files to configure celery and have your pyramid configuration inside celery tasks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature

  • Decorator based task
  • auto route and import
  • ONLY support mongodb

Getting Started

Include pyramid_celery either by setting your includes in your .ini, or by calling config.include('pyramid_celery').

    pyramid.includes = pyramid_celery
    mongodb.uri = mongodb://localhost:1234
    celery.dbname = celery

This will register all the functions decerotated with @task.

Then do scan to activate celery broker in myapp/init.py:

    config.scan()

Now you can either use class based:

from pyramid_celery import task

@task(name='add')
def add(self, x, y):
    print x+y

to define route of a task, do

from pyramid_celery import Task
class RemoteTask(Task):
	queue = 'remote'

@RemoteTask()
def mult(self, x, y):
    return x*y

Configuration

All standard celery configuration options will work. Check out http://ask.github.com/celery/configuration.html

Demo

Not supported currently

About

Pyramid configuration with celery integration. Allows you to use pyramid .ini files to configure celery and have your pyramid configuration inside celery tasks.


Languages

Language:Python 100.0%