GithubHelp home page GithubHelp logo

aio-job-queue's Introduction

Reliable queue implementation with Redis backend and python-asyncio client

Requirements:

  • python3.5
  • aioredis (we only need Redis object with awaitable methods)

Basic usage:

Redis object should be created before Queue init. This way you may use the same connecton to Redis for different purposes in your program.

import asyncio
import aioredis
import aioredisqueue

loop = asyncio.get_event_loop()

async def process_jobs():
    redis = await aioredis.create_reconnecting_redis(...)
    queue = aioredisqueue.Queue(redis)
    await q.put(b'abc')

    task = await q.get()
    print(task.payload)

    await task.ack()


loop.run_until_complete(process_jobs)

Non-standard features:

All methods are coroutines, even get_nowait. That's because calls to redis are performed during each such call.

What can change soon

API changes

  • loop may be deleted from constructor params

New features

  • Task classes with built-in serialization support
  • max_items limit support: current version of put method will be renamed into put_nowait.
  • get_multi and put_multi methods, allowing getting and putting multiple items from queue with one call
  • method for periodical requeueing of not acknowledged tasks
  • keeping track of times a task was requeued, dropping too old tasks or tasks with too many retries.

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.