GithubHelp home page GithubHelp logo

nextgisweb_celery's Introduction

nextgisweb_celery

How to use

  • Install to venv
./env/bin/pip install -e ./nextgisweb-celery
  • Create config for celery
    celery.ini example:
[celery]
BROKER_URL = redis://localhost:6379/1
RESULT_BACKEND = redis://localhost:6379/2
ACCEPT_CONTENT = ['application/json']
TASK_SERIALIZER = 'json'
RESULT_SERIALIZER = 'json'
  • Add path to ngw config
    config.ini example:
...
[celery]
celery_conf_file = /my/path/celery.ini
...
  • Create your task in your component
    tasks.py example:
from nextgisweb_celery.app import celery_app as app

@app.task(reject_on_worker_lost=True, soft_time_limit=60*60)
def add(x, y):
    return x+y
  • Import your tasks in your component init (DO IT!)
    __init__.py example:
...
from .tasks import add
...
  • Use your task in your component
    view.py example:
from .tasks import add

...
add.delay(7,5)
...
  • Start celery
./env/bin/celery -A nextgisweb_celery.app.celery_app --ngw-config /my/path/config.ini

nextgisweb_celery's People

Contributors

yellow-sky avatar simgislab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.