{"id":13501732,"url":"https://github.com/nvdv/atq","last_synced_at":"2025-04-15T16:35:03.093Z","repository":{"id":57412436,"uuid":"102112612","full_name":"nvdv/atq","owner":"nvdv","description":"distributed task queue for asyncio","archived":false,"fork":false,"pushed_at":"2017-10-26T09:43:51.000Z","size":19,"stargazers_count":89,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-03-14T09:32:01.270Z","etag":null,"topics":["async-await","asyncio","python","python3","task-queue"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvdv.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-01T12:54:27.000Z","updated_at":"2024-01-04T16:16:53.000Z","dependencies_parsed_at":"2022-09-09T20:02:20.511Z","dependency_job_id":null,"html_url":"https://github.com/nvdv/atq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvdv%2Fatq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvdv%2Fatq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvdv%2Fatq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvdv%2Fatq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvdv","download_url":"https://codeload.github.com/nvdv/atq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109131,"owners_count":21214113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","asyncio","python","python3","task-queue"],"created_at":"2024-07-31T22:01:47.858Z","updated_at":"2025-04-15T16:35:03.066Z","avatar_url":"https://github.com/nvdv.png","language":"Python","readme":"atq\n===\n``atq`` is a pure-Python asynchronous task queue built to work with ``asyncio``.\nIt is designed to run costly functions outside main event loop using\ndistributed workers.\n\n``atq`` requires Python 3.5+ and is distributed under BSD license.\n\nUsage\n-----\nFirst, you should start workers on the servers you plan to use for task execution\n\n.. code-block ::\n\n   atqserver --host \u003chostname\u003e --port \u003cport-number\u003e --worker \u003cnum-workers\u003e\n\nwhere\n\n- ``\u003chostname\u003e`` is a hostname of the server\n- ``\u003cport-number\u003e`` is a port that server will listen on\n- ``\u003cnum-workers\u003e`` is a number of worker processes\n\nPlease note that code of tasks should be accessible by ``atq``, so it's advised\nto run ``atq`` server from your project root directory in more complex\nsituations.\n\nThen you will need to create a client using hostnames and ports of initialized\nservers:\n\n.. code-block:: python\n\n   import atq\n\n   q = atq.Q([\n        (\"localhost\", 12345),\n    ])\n\n\nFinally you can use ``atq`` in your code:\n\n.. code-block:: python\n\n    import atq\n    import asyncio\n    import requests\n    from collections import ChainMap\n    from collections import Counter\n\n    URLS = [\n        ...\n    ]\n\n    q = atq.Q([\n        (\"localhost\", 12345),\n    ])\n\n    def top_words(url, n):\n        \"\"\"Returns top n words from text specified by url.\"\"\"\n        text = requests.get(url).text.split()\n        return {url: Counter(text).most_common(n)}\n\n    async def get_top_words(urls, n):\n        \"\"\"Returns top n words in documents specified by URLs.\"\"\"\n        tops_in_url = await asyncio.gather(\n            *[q.q(top_words, url, n) for url in urls])\n        return ChainMap(*tops_in_url)\n\n    top = asyncio.get_event_loop().run_until_complete(get_top_words(URLS, 10))\n\nYou can find more examples in ``examples`` subdirectory.\n\nInstallation\n------------\n.. code-block ::\n\n    pip3 install atq\n\n\nTesting\n-------\n.. code-block ::\n\n    python3 setup.py test\n\n\nLicense\n-------\nBSD\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvdv%2Fatq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvdv%2Fatq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvdv%2Fatq/lists"}