Modern Redis task queue for Python 3
Project description
Redis task queue for Python 3 heavily inspired by Celery and RQ.
Distinctive features:
Threads first, workers are lightweight
Explicit, very little black magic that can bite you
Modern code in Python 3 and Lua
Workers are embeddable in regular processes for easy testing
See Design choices for more details
Quickstart
Install Spinach with pip:
pip install spinach
Create task and schedule two jobs, one executed now and one later:
from datetime import datetime, timedelta, timezone
from spinach import Tasks, MemoryBroker, Spinach
tasks = Tasks()
@tasks.task(name='compute')
def compute(a, b):
print('Computed {} + {} = {}'.format(a, b, a + b))
spin = Spinach(MemoryBroker())
spin.attach_tasks(tasks)
# Schedule a job to be executed ASAP
spin.schedule('compute', 5, 3)
# Schedule a job to be executed in 10 seconds
in_10_seconds = datetime.now(timezone.utc) + timedelta(seconds=10)
spin.schedule_at('compute', in_10_seconds, 20, 10)
print('Starting workers, ^C to quit')
spin.start_workers()
Documentation
The documentation is at https://spinach.readthedocs.io.
License
BSD 2-clause
Copyright (c) 2017, Nicolas Le Manchet All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.