Coder Social home page Coder Social logo

fennel's Introduction

Fennel

A task queue for Python 3.7+ based on Redis Streams with a Celery-like API.

https://fennel.dev/

Note: This is an alpha release. The project is under development, breaking changes are likely.

Features

  • Supports both sync (e.g. Django, Flask) and async (e.g. Starlette, FastAPI) code.
  • Sane defaults: at least once processing semantics, tasks acknowledged on completion.
  • Automatic retries with exponential backoff for fire-and-forget jobs.
  • Clear task statuses available (e.g. sent, executing, success).
  • Automatic task discovery (defaults to using **/tasks.py).
  • Exceptionally small and understandable codebase.

Installation

pip install fennel

Basic Usage

Run Redis and then execute your code in tasks.py:

from fennel import App

app = App(name='myapp', redis_url='redis://127.0.0.1')


@app.task
def foo(n):
    return n


# Enqueue a task to be executed in the background by a fennel worker process.
foo.delay(7)

Meanwhile, run the worker:

$ fennel worker --app tasks:app

Asynchronous API

Fennel also supports an async API. If your code is running in an event loop (e.g. via Starlette or FastAPI), you will want to use the async interface instead:

from fennel import App

app = App(name='myapp', redis_url='redis://127.0.0.1', interface='async')


@app.task
async def bar(x):
    return x


await bar.delay(5)

See also

If you need to ensure that all tasks for a given key are processed in-order, please see our sister project Runnel.

fennel's People

Contributors

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