Skip to main content

A minimalistic in-memory async Python Task queue

Project description

Kolona

A minimalistic in-memory async Python Task queue.

Install

pip install kolona

Features

  • Retry tasks
  • Multiple workers
  • In-memor only (no 3rd party message brokers required)
  • Python native using asyncio
  • Statically typed

Example

import asyncio

from kolona import task, Workers

# create a queue
QUEUE = asyncio.Queue()


@task(queue=QUEUE, max_retries=2)
async def purchase_listener(*args):
    print(f"purchase_listener -> args: {args}")


@task(queue=QUEUE, max_retries=3)
async def account_checker(*args):
    print(f"account_checker doing checking")


async def main():
    # queue 1 account_checker task
    await account_checker.enqueue()

    # queue 3 purchase_listener tasks, pass an argument into it
    for x in range(3):
        print(f"Queueing: task-{x}")
        await purchase_listener.enqueue(f"task-{x}")

    # start 3 workers
    workers = Workers(queue=QUEUE, name="worker", count=3)

    # block on workers
    await asyncio.gather(*workers.get())


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kolona-0.2.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

kolona-0.2.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file kolona-0.2.1.tar.gz.

File metadata

  • Download URL: kolona-0.2.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.9

File hashes

Hashes for kolona-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4de5cb6370a9cd257bb57ca5a804471d99004c8c4b7cb220b8fa20dd8ae7e48d
MD5 4c41b2676b8565dd67fec07ff7a4719c
BLAKE2b-256 e59d0319a5b12d62fde1fc5883d03779f0679be2729b1d7ed23b2b040f404816

See more details on using hashes here.

File details

Details for the file kolona-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: kolona-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.9

File hashes

Hashes for kolona-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b907f53e8037a38b28e2c474a9c07bfefabc3d4df0546d1f44e3244391ff0e45
MD5 2ee29ff054af628f61fc1e92715b1116
BLAKE2b-256 4ad63e48d364434c0ae3bc58147cb366e69cbdc75d30bd6871f497f5ce75c114

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page