Skip to main content

PyPI - License Wheel Mypy PyPI PyPI Coverage Status tox

PATIO Redis

PATIO is an acronym for Python Asynchronous Task for AsyncIO.

This package provides Redis broker implementation.

Example

Worker

import asyncio
import operator
from functools import reduce

from patio import Registry, ThreadPoolExecutor

from patio_redis import RedisBroker


rpc = Registry(project="test", strict=True)


@rpc("mul")
def mul(*args):
    return reduce(operator.mul, args)


async def main():
    async with ThreadPoolExecutor(rpc, max_workers=16) as executor:
        async with RedisBroker(
            executor, url="redis://127.0.0.1:6379", max_connections=50,
        ) as broker:
            await broker.join()


if __name__ == "__main__":
    asyncio.run(main())

Producer

import asyncio

from patio import NullExecutor, Registry

from patio_redis import RedisBroker


rpc = Registry(project="test", strict=True)


async def main():
    async with NullExecutor(rpc) as executor:
        async with RedisBroker(
            executor, url="redis://127.0.0.1/", max_connections=50,
        ) as broker:
            for i in range(50):
                print(
                    await asyncio.gather(
                        *[
                            broker.call("mul", i, j, timeout=1)
                            for j in range(200)
                        ]
                    ),
                )


if __name__ == "__main__":
    asyncio.run(main())

Metadata

Release files for patio-redis 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patio-redis 0.1.1
File Size Uploaded
patio_redis-0.1.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for patio-redis 0.1.1
File Interpreter ABI Platform
patio_redis-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / patio_redis-0.1.1.tar.gz

Download URL patio_redis-0.1.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6658d459bf1f81baa25012b143bedacd26fa0ca85c7a8d1ee97312ae1ad0b85f
BLAKE2b-256 checksum
How to use checksums
0bcd103b03eca157939f931fffa6e199680afe03ca0c2dacc94c246c26447450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.2 Darwin/22.4.0

Release files / patio_redis-0.1.1-py3-none-any.whl

Download URL patio_redis-0.1.1-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60fc72f16f5bb10ea4bf92e5737948200e8ec4cf8927270e2ddd98cbee1e5845
BLAKE2b-256 checksum
How to use checksums
986979be52004b04dcf3f091f0ada24a7ffdb5d7891e92320ff4a9ee1dd81847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.2 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page