All Projects → coleifer → Huey

coleifer / Huey

Licence: mit
a little task queue for python

Programming Languages

python
139335 projects - #7 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to Huey

Taskq
Golang asynchronous task/job queue with Redis, SQS, IronMQ, and in-memory backends
Stars: ✭ 555 (-85.24%)
Mutual labels:  redis, queue, task-queue
Redis Smq
A simple high-performance Redis message queue for Node.js.
Stars: ✭ 230 (-93.88%)
Mutual labels:  redis, queue
Flask Rq2
A Flask extension for RQ.
Stars: ✭ 176 (-95.32%)
Mutual labels:  redis, queue
tasq
A simple task queue implementation to enqeue jobs on local or remote processes.
Stars: ✭ 83 (-97.79%)
Mutual labels:  queue, task-queue
Lightbus
RPC & event framework for Python 3
Stars: ✭ 149 (-96.04%)
Mutual labels:  redis, queue
Phive Queue
$queue->push('I can be popped off after', '10 minutes');
Stars: ✭ 161 (-95.72%)
Mutual labels:  redis, queue
gostalkd
sjis.me
Stars: ✭ 18 (-99.52%)
Mutual labels:  queue, task-queue
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (-63.71%)
Mutual labels:  redis, queue
queue
A task queue library for Go.
Stars: ✭ 26 (-99.31%)
Mutual labels:  queue, task-queue
orkid-node
Reliable and modern Redis Streams based task queue for Node.js 🤖
Stars: ✭ 61 (-98.38%)
Mutual labels:  queue, task-queue
psched
Priority-based Task Scheduling for Modern C++
Stars: ✭ 59 (-98.43%)
Mutual labels:  queue, task-queue
Delayer
🌶️ 基于 Redis 的延迟队列中间件,采用 Golang 开发,支持 PHP、Golang 等多种语言客户端
Stars: ✭ 145 (-96.14%)
Mutual labels:  redis, queue
Simpleue
PHP queue worker and consumer - Ready for AWS SQS, Redis, Beanstalkd and others.
Stars: ✭ 124 (-96.7%)
Mutual labels:  redis, queue
Flask Redis Queue
Example of how to handle background processes with Flask, Redis Queue, and Docker
Stars: ✭ 163 (-95.67%)
Mutual labels:  redis, task-queue
Rsmq
Redis Simple Message Queue
Stars: ✭ 1,556 (-58.63%)
Mutual labels:  redis, queue
flask-redis-docker
A minimal template for dockerized flask app with redis task queue
Stars: ✭ 49 (-98.7%)
Mutual labels:  queue, task-queue
Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+377.85%)
Mutual labels:  redis, queue
Pytask Io
Python Async Task Queue
Stars: ✭ 81 (-97.85%)
Mutual labels:  redis, task-queue
Django Rq
A simple app that provides django integration for RQ (Redis Queue)
Stars: ✭ 1,361 (-63.81%)
Mutual labels:  redis, task-queue
theeye-of-sauron
TheEye Dockers and QuickStart
Stars: ✭ 27 (-99.28%)
Mutual labels:  queue, task-queue

http://media.charlesleifer.com/blog/photos/huey2-logo.png

a lightweight alternative.

huey is:

huey supports:

  • multi-process, multi-thread or greenlet task execution models
  • schedule tasks to execute at a given time, or after a given delay
  • schedule recurring tasks, like a crontab
  • automatically retry tasks that fail
  • task prioritization
  • task result storage
  • task expiration
  • task locking
  • task pipelines and chains

http://i.imgur.com/2EpRs.jpg

https://api.travis-ci.org/coleifer/huey.svg?branch=master

At a glance

from huey import RedisHuey, crontab

huey = RedisHuey('my-app', host='redis.myapp.com')

@huey.task()
def add_numbers(a, b):
    return a + b

@huey.task(retries=2, retry_delay=60)
def flaky_task(url):
    # This task might fail, in which case it will be retried up to 2 times
    # with a delay of 60s between retries.
    return this_might_fail(url)

@huey.periodic_task(crontab(minute='0', hour='3'))
def nightly_backup():
    sync_all_data()

Calling a task-decorated function will enqueue the function call for execution by the consumer. A special result handle is returned immediately, which can be used to fetch the result once the task is finished:

>>> from demo import add_numbers
>>> res = add_numbers(1, 2)
>>> res
<Result: task 6b6f36fc-da0d-4069-b46c-c0d4ccff1df6>

>>> res()
3

Tasks can be scheduled to run in the future:

>>> res = add_numbers.schedule((2, 3), delay=10)  # Will be run in ~10s.
>>> res(blocking=True)  # Will block until task finishes, in ~10s.
5

For much more, check out the guide or take a look at the example code.

Running the consumer

Run the consumer with four worker processes:

$ huey_consumer.py my_app.huey -k process -w 4

To run the consumer with a single worker thread (default):

$ huey_consumer.py my_app.huey

If your work-loads are mostly IO-bound, you can run the consumer with threads or greenlets instead. Because greenlets are so lightweight, you can run quite a few of them efficiently:

$ huey_consumer.py my_app.huey -k greenlet -w 32

Storage

Huey's design and feature-set were informed by the capabilities of the Redis database. Redis is a fantastic fit for a lightweight task queueing library like Huey: it's self-contained, versatile, and can be a multi-purpose solution for other web-application tasks like caching, event publishing, analytics, rate-limiting, and more.

Although Huey was designed with Redis in mind, the storage system implements a simple API and many other tools could be used instead of Redis if that's your preference.

Huey comes with builtin support for Redis, Sqlite and in-memory storage.

Documentation

See Huey documentation.

Project page

See source code and issue tracker on Github.

Huey is named in honor of my cat:

http://m.charlesleifer.com/t/800x-/blog/photos/p1473037658.76.jpg?key=mD9_qMaKBAuGPi95KzXYqg

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].