Skip to content

NicolasLM/spinach

Repository files navigation

Spinach

https://github.com/NicolasLM/spinach/workflows/Run%20tests/badge.svg?branch=master https://coveralls.io/repos/github/NicolasLM/spinach/badge.svg?branch=master https://readthedocs.org/projects/spinach/badge/?version=latest https://img.shields.io/badge/IRC-irc.libera.chat-1e72ff.svg?style=flat

Redis task queue for Python 3 heavily inspired by Celery and RQ.

Distinctive features:

  • Threaded and asyncio workers
  • At-least-once or at-most-once delivery per task
  • Periodic tasks without an additional process
  • Concurrency limits on queued jobs
  • Scheduling of tasks in batch
  • Integrations with Flask, Django, Logging, Sentry and Datadog
  • Embeddable workers for easier testing
  • See design choices for more details

Quickstart

Install Spinach with pip:

pip install spinach

Create a task and schedule a job to be executed now:

from spinach import Engine, MemoryBroker

spin = Engine(MemoryBroker())


@spin.task(name='compute')
def compute(a, b):
    print('Computed {} + {} = {}'.format(a, b, a + b))


# Schedule a job to be executed ASAP
spin.schedule(compute, 5, 3)

print('Starting workers, ^C to quit')
spin.start_workers()

Documentation

The documentation is at https://spinach.readthedocs.io.

IRC channel for online discussions #spinach on irc.libera.chat.

License

BSD 2-clause