All Projects → mher → Tornado Celery

mher / Tornado Celery

Licence: other
Non-blocking Celery client for Tornado

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tornado Celery

Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (-80.04%)
Mutual labels:  asyncio, asynchronous, tornado
Aiormq
Pure python AMQP 0.9.1 asynchronous client library
Stars: ✭ 112 (-80.04%)
Mutual labels:  async, asyncio, asynchronous
Chili
Chili: HTTP Served Hot
Stars: ✭ 7 (-98.75%)
Mutual labels:  async, asyncio, asynchronous
Kubernetes asyncio
Python asynchronous client library for Kubernetes http://kubernetes.io/
Stars: ✭ 147 (-73.8%)
Mutual labels:  async, asyncio, asynchronous
Peony Twitter
An asynchronous Twitter API client for Python 3.5+
Stars: ✭ 62 (-88.95%)
Mutual labels:  async, asyncio, asynchronous
Arsenic
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Stars: ✭ 209 (-62.75%)
Mutual labels:  async, asyncio, tornado
Autoops
linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台 本项目已停止开发!因长时间未对代码进行维护,可能会造成项目在不同环境上无法部署、运行BUG等问题,请知晓!项目仅供参考!
Stars: ✭ 340 (-39.39%)
Mutual labels:  celery, tornado
Webspider
在线地址: http://119.23.223.90:8000
Stars: ✭ 340 (-39.39%)
Mutual labels:  celery, tornado
Example Hftish
Example Order Book Imbalance Algorithm
Stars: ✭ 355 (-36.72%)
Mutual labels:  async, asyncio
Requests Threads
🎭 Twisted Deferred Thread backend for Requests.
Stars: ✭ 366 (-34.76%)
Mutual labels:  async, asyncio
Php Watcher
Monitor for any changes in your php application and automatically restart it (suitable for async apps).
Stars: ✭ 303 (-45.99%)
Mutual labels:  async, asynchronous
Picoweb
Really minimal web application framework for the Pycopy project (minimalist Python dialect) and its "uasyncio" async framework
Stars: ✭ 361 (-35.65%)
Mutual labels:  async, asyncio
Lahja
Lahja is a generic multi process event bus implementation written in Python 3.6+ to enable lightweight inter-process communication, based on non-blocking asyncio
Stars: ✭ 374 (-33.33%)
Mutual labels:  async, asyncio
Async Sema
Semaphore using `async` and `await`
Stars: ✭ 326 (-41.89%)
Mutual labels:  async, asynchronous
Doudizhu
html5 斗地主游戏
Stars: ✭ 323 (-42.42%)
Mutual labels:  asyncio, tornado
Predis Async
Asynchronous PHP client library for Redis built on top of ReactPHP
Stars: ✭ 354 (-36.9%)
Mutual labels:  async, asynchronous
Async Techniques Python Course
Async Techniques and Examples in Python Course
Stars: ✭ 314 (-44.03%)
Mutual labels:  async, asyncio
Github Stats
Better GitHub statistics images for your profile, no external server required
Stars: ✭ 338 (-39.75%)
Mutual labels:  async, asyncio
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+733.87%)
Mutual labels:  async, asynchronous
Aiotasks
A Celery like task manager that distributes Asyncio coroutines
Stars: ✭ 375 (-33.16%)
Mutual labels:  asyncio, celery

Celery integration with Tornado

.. image:: https://img.shields.io/pypi/v/tornado-celery.svg :target: https://pypi.python.org/pypi/tornado-celery

tornado-celery is a non-blocking Celery client for Tornado web framework

Usage

Calling Celery tasks from Tornado RequestHandler: ::

from tornado import gen, web
import tcelery, tasks

tcelery.setup_nonblocking_producer()

class AsyncHandler(web.RequestHandler):
    @asynchronous
    def get(self):
        tasks.echo.apply_async(args=['Hello world!'], callback=self.on_result)

    def on_result(self, response):
        self.write(str(response.result))
        self.finish()

Calling tasks with generator-based interface: ::

class GenAsyncHandler(web.RequestHandler):
    @asynchronous
    @gen.coroutine
    def get(self):
        response = yield gen.Task(tasks.sleep.apply_async, args=[3])
        self.write(str(response.result))
        self.finish()

NOTE: Currently callbacks only work with AMQP and Redis backends. To use the Redis backend, you must install tornado-redis <https://github.com/leporo/tornado-redis>_.

tornado-celery can be launched as a web server: ::

$ cd tornado-celery
$ python -m tcelery --port=8888 --app=examples.tasks --address=0.0.0.0

Execute a task asynchronously: ::

$ curl -X POST -d '{"args":["hello"]}' http://localhost:8888/apply-async/examples.tasks.echo/
{"task-id": "a24c9e38-4976-426a-83d6-6b10b4de7ab1", "state": "PENDING"}

Get the result: ::

$ curl http://localhost:8888/tasks/result/a24c9e38-4976-426a-83d6-6b10b4de7ab1/
{"task-id": "a24c9e38-4976-426a-83d6-6b10b4de7ab1", "state": "SUCCESS", "result": "hello"}

Execute a task and get the result: ::

$ curl -X POST -d '{"args":[1,2]}' http://localhost:8888/apply/examples.tasks.add/
{"task-id": "fe3cc5a5-d11b-4b17-a6e2-e7fd2fba7ec6", "state": "SUCCESS", "result": 3}

Execute a task with timeout: ::

$ curl -X POST -d '{"args":[5],"timeout":1}' http://localhost:8888/apply/examples.tasks.sleep/
{"task-id": "9ca78e26-bbb2-404c-b3bb-bc1c63cbdf41", "state": "REVOKED"}

Installation

To install, simply: ::

$ pip install tornado-celery

Documentation

Documentation is available at Read the Docs_

.. _Read the Docs: http://tornado-celery.readthedocs.org

Running the Tests

To run the tests for the AMQP backend: ::

$ python examples/tasks.py worker
$ cd examples && python -m tcelery -A tasks
$ python tests/functests.py

To run the tests for the Redis backend, first make sure redis is running, then: ::

$ CELERY_RESULT_BACKEND=redis:// python examples/tasks.py worker
$ cd examples && CELERY_RESULT_BACKEND=redis:// python -m tcelery -A tasks
$ python tests/functests.py
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].