patio-redis


Namepatio-redis JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryRedis broker implementation for PATIO
upload_time2023-06-09 08:19:12
maintainer
docs_urlNone
authorDmitry Orlov
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI - License](https://img.shields.io/pypi/l/patio-redis)](https://pypi.org/project/patio-redis) [![Wheel](https://img.shields.io/pypi/wheel/patio-redis)](https://pypi.org/project/patio-redis) [![Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)]() [![PyPI](https://img.shields.io/pypi/v/patio-redis)](https://pypi.org/project/patio-redis) [![PyPI](https://img.shields.io/pypi/pyversions/patio-redis)](https://pypi.org/project/patio-redis) [![Coverage Status](https://coveralls.io/repos/github/patio-python/patio-redis/badge.svg?branch=master)](https://coveralls.io/github/patio-python/patio-redis?branch=master) ![tox](https://github.com/patio-python/patio-redis/workflows/tests/badge.svg?branch=master)

PATIO Redis
===========

PATIO is an acronym for **P**ython **A**synchronous **T**ask for Async**IO**.

This package provides Redis broker implementation.

Example
-------

### Worker

```python
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

```python
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())
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "patio-redis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dmitry Orlov",
    "author_email": "me@mosquito.su",
    "download_url": "https://files.pythonhosted.org/packages/0b/cd/103b03eca157939f931fffa6e199680afe03ca0c2dacc94c246c26447450/patio_redis-0.1.1.tar.gz",
    "platform": null,
    "description": "[![PyPI - License](https://img.shields.io/pypi/l/patio-redis)](https://pypi.org/project/patio-redis) [![Wheel](https://img.shields.io/pypi/wheel/patio-redis)](https://pypi.org/project/patio-redis) [![Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)]() [![PyPI](https://img.shields.io/pypi/v/patio-redis)](https://pypi.org/project/patio-redis) [![PyPI](https://img.shields.io/pypi/pyversions/patio-redis)](https://pypi.org/project/patio-redis) [![Coverage Status](https://coveralls.io/repos/github/patio-python/patio-redis/badge.svg?branch=master)](https://coveralls.io/github/patio-python/patio-redis?branch=master) ![tox](https://github.com/patio-python/patio-redis/workflows/tests/badge.svg?branch=master)\n\nPATIO Redis\n===========\n\nPATIO is an acronym for **P**ython **A**synchronous **T**ask for Async**IO**.\n\nThis package provides Redis broker implementation.\n\nExample\n-------\n\n### Worker\n\n```python\nimport asyncio\nimport operator\nfrom functools import reduce\n\nfrom patio import Registry, ThreadPoolExecutor\n\nfrom patio_redis import RedisBroker\n\n\nrpc = Registry(project=\"test\", strict=True)\n\n\n@rpc(\"mul\")\ndef mul(*args):\n    return reduce(operator.mul, args)\n\n\nasync def main():\n    async with ThreadPoolExecutor(rpc, max_workers=16) as executor:\n        async with RedisBroker(\n            executor, url=\"redis://127.0.0.1:6379\", max_connections=50,\n        ) as broker:\n            await broker.join()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n```\n\n### Producer\n\n```python\nimport asyncio\n\nfrom patio import NullExecutor, Registry\n\nfrom patio_redis import RedisBroker\n\n\nrpc = Registry(project=\"test\", strict=True)\n\n\nasync def main():\n    async with NullExecutor(rpc) as executor:\n        async with RedisBroker(\n            executor, url=\"redis://127.0.0.1/\", max_connections=50,\n        ) as broker:\n            for i in range(50):\n                print(\n                    await asyncio.gather(\n                        *[\n                            broker.call(\"mul\", i, j, timeout=1)\n                            for j in range(200)\n                        ]\n                    ),\n                )\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Redis broker implementation for PATIO",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "986979be52004b04dcf3f091f0ada24a7ffdb5d7891e92320ff4a9ee1dd81847",
                "md5": "74a4b91ca0d981bfa8140381b37e4a66",
                "sha256": "60fc72f16f5bb10ea4bf92e5737948200e8ec4cf8927270e2ddd98cbee1e5845"
            },
            "downloads": -1,
            "filename": "patio_redis-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74a4b91ca0d981bfa8140381b37e4a66",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 4565,
            "upload_time": "2023-06-09T08:19:11",
            "upload_time_iso_8601": "2023-06-09T08:19:11.135770Z",
            "url": "https://files.pythonhosted.org/packages/98/69/79be52004b04dcf3f091f0ada24a7ffdb5d7891e92320ff4a9ee1dd81847/patio_redis-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bcd103b03eca157939f931fffa6e199680afe03ca0c2dacc94c246c26447450",
                "md5": "0d3c89e7993cdb098cf108474279aae2",
                "sha256": "6658d459bf1f81baa25012b143bedacd26fa0ca85c7a8d1ee97312ae1ad0b85f"
            },
            "downloads": -1,
            "filename": "patio_redis-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0d3c89e7993cdb098cf108474279aae2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 3811,
            "upload_time": "2023-06-09T08:19:12",
            "upload_time_iso_8601": "2023-06-09T08:19:12.610688Z",
            "url": "https://files.pythonhosted.org/packages/0b/cd/103b03eca157939f931fffa6e199680afe03ca0c2dacc94c246c26447450/patio_redis-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 08:19:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "patio-redis"
}
        
Elapsed time: 0.22512s